aboutsummaryrefslogtreecommitdiff
path: root/src/portable.rs
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2023-05-28 19:36:32 +0200
committerJack O'Connor <[email protected]>2024-08-15 16:02:10 -0700
commite74172acc35f599497243946e2f3cb3aa3f83f40 (patch)
tree7c417e5e4edc4795a9e0d528929adcf09d9e069e /src/portable.rs
parent80b83effbd50425939483e5503b186db4dac4d9d (diff)
integrate xof_many with the Rust implementation and with Rust and C tests
Diffstat (limited to 'src/portable.rs')
-rw-r--r--src/portable.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/portable.rs b/src/portable.rs
index 7af6828..822cd0d 100644
--- a/src/portable.rs
+++ b/src/portable.rs
@@ -177,6 +177,20 @@ pub fn hash_many<const N: usize>(
}
}
+pub fn xof_many(
+ cv: &CVWords,
+ block: &[u8; BLOCK_LEN],
+ block_len: u8,
+ mut counter: u64,
+ flags: u8,
+ out: &mut [u8],
+) {
+ for out_block in out.chunks_exact_mut(64) {
+ out_block.copy_from_slice(&compress_xof(cv, block, block_len, counter, flags));
+ counter += 1;
+ }
+}
+
#[cfg(test)]
pub mod test {
use super::*;
@@ -195,4 +209,10 @@ pub mod test {
fn test_hash_many() {
crate::test::test_hash_many_fn(hash_many, hash_many);
}
+
+ // Ditto.
+ #[test]
+ fn test_xof_many() {
+ crate::test::test_xof_many_fn(xof_many);
+ }
}