diff options
| author | Jack O'Connor <[email protected]> | 2020-01-21 14:04:59 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2020-01-22 21:32:39 -0500 |
| commit | 163f52245d3f6cfcc2ec2c91e01412ffba5f6d45 (patch) | |
| tree | 91937cc6aba2bb9d63b83b4d82b431fb9f9b9446 /c/blake3.h | |
| parent | de1cf0038e26b8371408b4cb8b7fc6b4a47659df (diff) | |
port compress_subtree_to_parent_node from Rust to C
This recursive function performs parallel parent node hashing, which is
an important optimization.
Diffstat (limited to 'c/blake3.h')
| -rw-r--r-- | c/blake3.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -23,7 +23,12 @@ typedef struct { uint32_t key[8]; blake3_chunk_state chunk; uint8_t cv_stack_len; - uint8_t cv_stack[BLAKE3_MAX_DEPTH * BLAKE3_OUT_LEN]; + // The stack size is MAX_DEPTH + 1 because we do lazy merging. For example, + // with 7 chunks, we have 3 entries in the stack. Adding an 8th chunk + // requires a 4th entry, rather than merging everything down to 1, because we + // don't know whether more input is coming. This is different from how the + // reference implementation does things. + uint8_t cv_stack[(BLAKE3_MAX_DEPTH + 1) * BLAKE3_OUT_LEN]; } blake3_hasher; void blake3_hasher_init(blake3_hasher *self); |
