diff options
| author | Jack O'Connor <[email protected]> | 2024-08-18 15:36:11 -0700 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2024-08-18 17:43:58 -0700 |
| commit | dcff6b65acdd978863512c2d9c1359aef2564ea4 (patch) | |
| tree | 22126611ede951804d2818e7fbef2e9fad83348c /src | |
| parent | 5c4c351a1a0729f8e7a88e6895379bb952ed1a07 (diff) | |
delete portable::xof_many and blake3_xof_many_portable
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable.rs | 25 | ||||
| -rw-r--r-- | src/test.rs | 19 |
2 files changed, 11 insertions, 33 deletions
diff --git a/src/portable.rs b/src/portable.rs index 35b5f5d..7af6828 100644 --- a/src/portable.rs +++ b/src/portable.rs @@ -177,25 +177,6 @@ pub fn hash_many<const N: usize>( } } -// This function is test-only. When platform::xof_many() doesn't have an optimized implementation, -// it loops over platform::compress_xof() instead of falling back to this, so it still benefits -// from compress optimizations. -#[cfg(test)] -pub fn xof_many( - cv: &CVWords, - block: &[u8; BLOCK_LEN], - block_len: u8, - mut counter: u64, - flags: u8, - out: &mut [u8], -) { - debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only"); - 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::*; @@ -214,10 +195,4 @@ 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); - } } diff --git a/src/test.rs b/src/test.rs index 251a783..bb99d10 100644 --- a/src/test.rs +++ b/src/test.rs @@ -206,6 +206,7 @@ pub fn test_hash_many_fn( } } +#[allow(unused)] type XofManyFunction = unsafe fn( cv: &CVWords, block: &[u8; BLOCK_LEN], @@ -216,6 +217,7 @@ type XofManyFunction = unsafe fn( ); // A shared helper function for platform-specific tests. +#[allow(unused)] pub fn test_xof_many_fn(xof_many_function: XofManyFunction) { let mut block = [0; BLOCK_LEN]; let block_len = 42; @@ -237,14 +239,15 @@ pub fn test_xof_many_fn(xof_many_function: XofManyFunction) { const OUTPUT_SIZE: usize = 31 * BLOCK_LEN; let mut portable_out = [0u8; OUTPUT_SIZE]; - crate::portable::xof_many( - &cv, - &block, - block_len as u8, - counter, - flags, - &mut portable_out, - ); + for (i, out_block) in portable_out.chunks_exact_mut(64).enumerate() { + out_block.copy_from_slice(&crate::portable::compress_xof( + &cv, + &block, + block_len as u8, + counter + i as u64, + flags, + )); + } let mut test_out = [0u8; OUTPUT_SIZE]; unsafe { |
