DoxigAlpha

SipHash128

SipHash function with 128-bit output.

Recommended parameters are:

  • (c_rounds=4, d_rounds=8) for conservative security; regular hash functions such as BLAKE2 or BLAKE3 are usually a better alternative.
  • (c_rounds=2, d_rounds=4) standard parameters.
  • (c_rounds=1, d_rounds=4) reduced-round function. Recommended to hash very short, similar strings, when a 128-bit PRF output is still required.
  • (c_rounds=1, d_rounds=3) reduced-round function. Faster, no known implications on its practical security level.
  • (c_rounds=1, d_rounds=2) fastest option, but the output may be distinguishable from random data with related keys or non-uniform input - not suitable as a PRF.

SipHash is not a traditional hash function. If the input includes untrusted content, a secret key is absolutely necessary.

Fields of this type

Fields

#
buf:[8]u8
buf_len:usize

Initialize a state for a SipHash function

Functions

#
init
Initialize a state for a SipHash function
update
Add data to the state
final
Return an authentication tag for the current state
create
Return an authentication tag for a message and a key
finalInt
Return an authentication tag for the current state, as an integer
toInt
Return an authentication tag for a message and a key, as an integer

Error sets in this namespace

Error Sets

#

= 16

Values

#
mac_length
= @sizeOf(T)

Source

Implementation

#
pub fn SipHash128(comptime c_rounds: usize, comptime d_rounds: usize) type {
    return SipHash(u128, c_rounds, d_rounds);
}