Skip to content
Closed
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
6 changes: 6 additions & 0 deletions acvm-repo/blackbox_solver/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
}

pub fn blake3(inputs: &[u8]) -> Result<[u8; 32], BlackBoxResolutionError> {
if inputs.len() > 1024 {
return Err(BlackBoxResolutionError::Failed(
BlackBoxFunc::Blake3,
"the input length should be less than 1024 bytes".to_string(),
));
}
Ok(blake3::hash(inputs).into())
}

Expand All @@ -27,7 +33,7 @@
let bytes = block.to_be_bytes();
blocks[i * 4..i * 4 + 4].copy_from_slice(&bytes);
}
let blocks: GenericArray<u8, sha2::digest::typenum::U64> = blocks.into();

Check warning on line 36 in acvm-repo/blackbox_solver/src/hash.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (typenum)
sha2::compress256(state, &[blocks]);
}

Expand All @@ -46,7 +52,7 @@

#[test]
fn sanity_check() {
// Test vectors are copied from XKCP (eXtended Keccak Code Package)

Check warning on line 55 in acvm-repo/blackbox_solver/src/hash.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (XKCP)
// https://github.com/XKCP/XKCP/blob/master/tests/TestVectors/KeccakF-1600-IntermediateValues.txt
let zero_state = [0u64; 25];

Expand Down
Loading