# `Uniq.SipHash`
[🔗](https://github.com/bitwalker/uniq/blob/main/lib/siphash.ex#L1)

SipHash-2-4 implementation for cryptographic hashing.

SipHash is a fast, short-input PRF designed for hash tables and
other applications where speed and security matter. This module
implements the SipHash-2-4 variant, which uses 2 compression rounds
and 4 finalization rounds.

## References

* [SipHash Paper](https://131002.net/siphash/siphash.pdf)
* [UUIDv47 Specification](https://github.com/stateless-me/uuidv47)

# `key`

```elixir
@type key() :: {0..18_446_744_073_709_551_615, 0..18_446_744_073_709_551_615}
```

# `hash`

```elixir
@spec hash(key(), binary()) :: non_neg_integer()
```

Computes SipHash-2-4 of the given message with the provided key.

The key should be a tuple of two 64-bit integers `{k0, k1}`.
Returns a 64-bit integer hash value.

## Examples

    iex> key = {0x0123456789abcdef, 0xfedcba9876543210}
    iex> message = <<1, 2, 3, 4, 5>>
    iex> hash1 = Uniq.SipHash.hash(key, message)
    iex> hash2 = Uniq.SipHash.hash(key, message)
    iex> hash1 == hash2
    true

