Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions contracts/BLAKE2b/BLAKE2b.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ contract BLAKE2b is GasTest, BLAKE2_Constants{
// Add any uncounted bytes
ctx.t += ctx.c;

// zero out left over bytes (if key is longer than input)
uint c = ctx.c++;
uint8 a = 0;
uint256[4] memory b = ctx.b;
for(uint i = c; i < 128; i++) {
// ctx.b[i] = 0
assembly{
mstore8(add(b,i),a)
}
}

// Compress with finalization flag
compress(ctx,true);

Expand Down