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. Private Function

hash128

Private Function
std.hash.xxhash.XxHash3.hash128
fn hash128(seed: u64, input: anytype, noalias secret: *const [192]u8) u64

Params

  • seed: u64
  • input
  • secret: *const [192]u8

File

hash/xxhash.zig:650
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
    fn hash128(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
        @branchHint(.unlikely);
        std.debug.assert(input.len > 16 and input.len <= 128);

        var acc = XxHash64.prime_1 *% @as(u64, input.len);
        inline for (0..4) |i| {
            const in_offset = 48 - (i * 16);
            const scrt_offset = 96 - (i * 32);
            if (input.len > scrt_offset) {
                acc +%= mix16(seed, input[in_offset..], secret[scrt_offset..]);
                acc +%= mix16(seed, input[input.len - (in_offset + 16) ..], secret[scrt_offset + 16 ..]);
            }
        }
        return avalanche(.h3, acc);
    }