Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Type Function

SipHash64

Public Type Function
std.crypto.siphash.SipHash64
pub 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.

File

crypto/siphash.zig:25
25
26
27
pub fn SipHash64(comptime c_rounds: usize, comptime d_rounds: usize) type {
    return SipHash(u64, c_rounds, d_rounds);
}