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
Summary
Functions
Computes SipHash-2-4 of the given message with the provided key.
Types
Functions
@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