Skip to content

Commit

Permalink
FIXUP TurboSHAKE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Mar 16, 2023
1 parent aec79c0 commit 098df34
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sha3/tests/turboshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ use digest::ExtendableOutput;
pub(crate) fn turbo_shake_test<D, F>(
input: &[u8],
output: &[u8],
truncate_output: usize,
truncate_output: u64,
new: F,
) -> Option<&'static str>
where
D: ExtendableOutput + Debug + Clone,
F: Fn() -> D,
{
let truncate_output: usize = truncate_output.try_into().unwrap();

let mut hasher = new();
let mut buf = [0u8; 16 * 1024];
let buf = &mut buf[..truncate_output + output.len()];
Expand Down Expand Up @@ -55,7 +57,7 @@ macro_rules! new_turbo_shake_test {
input.to_vec()
} else if (input.len() == 0) {
let pattern_length =
usize::from_be_bytes(input_pattern_length.try_into().unwrap());
u64::from_be_bytes(input_pattern_length.try_into().unwrap());
let mut input = Vec::<u8>::new();
for value in 0..pattern_length {
input.push((value % 0xFB).try_into().unwrap());
Expand All @@ -74,7 +76,7 @@ macro_rules! new_turbo_shake_test {
if let Some(desc) = $test_func(
&input,
output,
usize::from_be_bytes(truncate_output.try_into().unwrap()),
u64::from_be_bytes(truncate_output.try_into().unwrap()),
|| <$hasher>::from_core(<$hasher_core>::new(domain_separation[0])),
) {
panic!(
Expand Down

0 comments on commit 098df34

Please sign in to comment.