fn SipHash64(comptime c_rounds: usize, comptime d_rounds: usize) type

SipHash function with 64-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=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. And due to its small output size, collisions in SipHash64 can be found with an exhaustive search.

Parameters

c_rounds: usize,
d_rounds: usize,

Fields

state: State,
buf: [8]u8,
buf_len: usize,

Functions

fn create(out: *[mac_length]u8, msg: []const u8, key: *const [key_length]u8) void

Return an authentication tag for a message and a key

fn final(self: *Self, out: *[mac_length]u8) void

Return an authentication tag for the current state Assumes out is less than o…

Return an authentication tag for the current state Assumes out is less than or equal to mac_length.

fn finalInt(self: *Self) T

Return an authentication tag for the current state, as an integer

fn finalResult(self: *Self) [mac_length]u8

No documentation provided.

fn init(key: *const [key_length]u8) Self

Initialize a state for a SipHash function

fn peek(self: Self) [mac_length]u8

No documentation provided.

fn toInt(msg: []const u8, key: *const [key_length]u8) T

Return an authentication tag for a message and a key, as an integer

fn update(self: *Self, b: []const u8) void

Add data to the state

fn writer(self: *Self) Writer

No documentation provided.

Values

Writer
undefined
block_length
comptime_int
key_length
comptime_int
mac_length
comptime_int

Error Sets