bash-prg-hash: Initial implementation#751
bash-prg-hash: Initial implementation#751makavity wants to merge 42 commits intoRustCrypto:masterfrom
bash-prg-hash: Initial implementation#751Conversation
|
I am also not sure, it should be implemented as prg-hash. |
newpavlov
left a comment
There was a problem hiding this comment.
Sorry for the late review!
Some preliminary comments without looking deep at the implementation and the spec.
|
Thanks for review, @newpavlov. |
|
Looks like the |
|
I added |
Cannot implement squeeze. for block in &mut blocks {
sponge(state);
let mut dst_chunks = block.chunks_exact_mut(size_of::<u64>());
for (src, dst_chunk) in state.iter_mut().zip(&mut dst_chunks) {
dst_chunk.copy_from_slice(&src.to_le_bytes());
}
assert!(dst_chunks.into_remainder().is_empty());
}This does permute then read, while Should I left it as-is, or maybe another mode in |
…artially use `SpongeCursor`
|
I've commited it without |
Can not say right now, I will need to read the spec first. |
| digest::new_test!(bashprg1282, BashPrgHash1282, xof_reset_test); | ||
| digest::new_test!(bashprg1921, BashPrgHash1921, xof_reset_test); | ||
| // Not in STB 34.101.77-2020, but included for completeness | ||
| digest::new_test!(bashprg2562, BashPrgHash2562, xof_reset_test); |
There was a problem hiding this comment.
Are there any vectors for customized hashing? IIUC they are not part of the STB. It may be worth to generate synthetic tests for it.
There was a problem hiding this comment.
I'll check the testing methodic and will extend the tests.
There was a problem hiding this comment.
Found it in the methodics.
https://apmi.bsu.by/assets/files/std/met-v10.zip
I'll add it and tweak xof_test for the try_new_customized.
There was a problem hiding this comment.
See the cshake test for an example. We probably will add a function for this into a future version of digest.
…of_reset_test` from `digest::dev`)
|
I refactored the code a fair bit. Feel free to comment on the changes if something is not clear or if you have suggestions on how we could improve it. I think this PR is mostly ready for merge. We only need to release |
|
|
||
| // Step 2: S[r] <- S[r] ⊕ 1, where r = 1536 - 2 d ℓ (bit index). | ||
| const { assert!(RATE % 8 == 0) } | ||
| self.state[RATE / 8] ^= 1u64 << 7; |
There was a problem hiding this comment.
This looks a bit weird, but I guess it's a consequence of mixing little-endian byte order and big-endian bit order in the spec and commit acting on the state outside of the rate part. For comparison, in cshake and turboshake we use self.state[RATE / 8 - 1] ^= 1 << 63;.
Looks like the commit |
|
Just misspell in the header length calculation. |
newandnew_with_empty_headerfunctions.