Skip to content

Commit a91ad8b

Browse files
committed
fix padding
1 parent a40e900 commit a91ad8b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
CARGO_TERM_COLOR: always
11-
MINIMUM_NOIR_VERSION: v1.0.0-beta.13
11+
MINIMUM_NOIR_VERSION: v1.0.0-beta.9
1212

1313
jobs:
1414
noir-version-list:

src/keccak256.nr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ pub fn keccak256<let N: u32>(input: [u8; N], message_size: u32) -> [u8; 32] {
3636
let real_blocks_bytes = real_max_blocks * BLOCK_SIZE_IN_BYTES;
3737

3838
block_bytes[message_size] = 1;
39-
block_bytes[real_blocks_bytes - 1] = 0x80;
39+
//block_bytes[real_blocks_bytes - 1] = 0x80;
40+
if message_size == real_blocks_bytes - 1 {
41+
// combine both padding bits into a single byte
42+
block_bytes[message_size] = 0x81;
43+
} else {
44+
block_bytes[real_blocks_bytes - 1] = 0x80;
45+
}
4046

4147
// populate a vector of 64-bit limbs from our byte array
4248
let mut sliced_buffer =

0 commit comments

Comments
 (0)