| ... | @@ -338,7 +338,7 @@ pub const Blake3 = struct { | ... | @@ -338,7 +338,7 @@ pub const Blake3 = struct { |
| 338 | } | 338 | } |
| 339 | | 339 | |
| 340 | // Section 5.1.2 of the BLAKE3 spec explains this algorithm in more detail. | 340 | // Section 5.1.2 of the BLAKE3 spec explains this algorithm in more detail. |
| 341 | fn add_chunk_chaining_value(self: *Blake3, new_cv: [8]u32, total_chunks: u64) void { | 341 | fn add_chunk_chaining_value(self: *Blake3, first_cv: [8]u32, total_chunks: u64) void { |
| 342 | // This chunk might complete some subtrees. For each completed subtree, | 342 | // This chunk might complete some subtrees. For each completed subtree, |
| 343 | // its left child will be the current top entry in the CV stack, and | 343 | // its left child will be the current top entry in the CV stack, and |
| 344 | // its right child will be the current value of `new_cv`. Pop each left | 344 | // its right child will be the current value of `new_cv`. Pop each left |
| ... | @@ -346,6 +346,7 @@ pub const Blake3 = struct { | ... | @@ -346,6 +346,7 @@ pub const Blake3 = struct { |
| 346 | // with the result. After all these merges, push the final value of | 346 | // with the result. After all these merges, push the final value of |
| 347 | // `new_cv` onto the stack. The number of completed subtrees is given | 347 | // `new_cv` onto the stack. The number of completed subtrees is given |
| 348 | // by the number of trailing 0-bits in the new total number of chunks. | 348 | // by the number of trailing 0-bits in the new total number of chunks. |
| | 349 | var new_cv = first_cv; |
| 349 | var chunk_counter = total_chunks; | 350 | var chunk_counter = total_chunks; |
| 350 | while (chunk_counter & 1 == 0) { | 351 | while (chunk_counter & 1 == 0) { |
| 351 | new_cv = parent_cv(self.pop_cv(), new_cv, self.key, self.flags); | 352 | new_cv = parent_cv(self.pop_cv(), new_cv, self.key, self.flags); |