Zig 0.17.0-dev (Split by item)

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 library itself.

hashOne

blake3.hashOne
fn hashOne(input: []const u8, blocks: usize, key: [8]u32, counter: u64, flags: Flags, flags_start: Flags, flags_end: Flags) [Blake3.digest_length]u8

File

lib/std/crypto/blake3.zig:182

Code

fn hashOne(input: []const u8, blocks: usize, key: [8]u32, counter: u64, flags: Flags, flags_start: Flags, flags_end: Flags) [Blake3.digest_length]u8 {
    var cv = key;
    var block_flags = flags.with(flags_start);
    var inp = input;
    var remaining_blocks = blocks;

    while (remaining_blocks > 0) {
        if (remaining_blocks == 1) {
            block_flags = block_flags.with(flags_end);
        }
        compressInPlace(&cv, inp[0..Blake3.block_length], Blake3.block_length, counter, block_flags);
        inp = inp[Blake3.block_length..];
        remaining_blocks -= 1;
        block_flags = flags;
    }

    return storeCvWords(cv);
}