Skip to content

Commit 8a46c3b

Browse files
authored
Remove implementation of BlockSizeUser for XOFs (#856)
The primary use of `BlockSizeUser` is implementation of HMAC. Our implementation in `hmac` requires fixed output, so XOFs can not be used with it (without `XofFixedWrapper`). XOFs should not be used with HMAC either way, so we probably can drop the impls.
1 parent ce183db commit 8a46c3b

9 files changed

Lines changed: 25 additions & 60 deletions

File tree

cshake/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Internal implementation by removing unnecessary buffering ([#849])
1414
- `Rate: BlockSizes` generic parameter to `const RATE: usize` ([#849])
1515

16+
### Removed
17+
- Implementations of `BlockSizeUser` ([#856])
18+
1619
[#849]: https://github.com/RustCrypto/hashes/pull/849
1720
[#855]: https://github.com/RustCrypto/hashes/pull/855
21+
[#856]: https://github.com/RustCrypto/hashes/pull/856
1822

1923
## 0.1.1 (2026-04-19)
2024
### Fixed

cshake/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub use digest;
1414
use core::fmt;
1515
use digest::{
1616
CollisionResistance, CustomizedInit, ExtendableOutput, HashMarker, Update, XofReader,
17-
common::{AlgorithmName, BlockSizeUser},
18-
consts::{U16, U32, U136, U168},
17+
common::AlgorithmName,
18+
consts::{U16, U32},
1919
};
2020
use keccak::{Keccak, State1600};
2121
use sponge_cursor::SpongeCursor;
@@ -238,11 +238,3 @@ impl CollisionResistance for CShake128 {
238238
impl CollisionResistance for CShake256 {
239239
type CollisionResistance = U32;
240240
}
241-
242-
impl BlockSizeUser for CShake128 {
243-
type BlockSize = U168;
244-
}
245-
246-
impl BlockSizeUser for CShake256 {
247-
type BlockSize = U136;
248-
}

k12/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Internal implementation by removing unnecessary buffering ([#849])
1111
- `Rate: BlockSizes` generic parameter to `const RATE: usize` ([#849])
1212

13+
### Removed
14+
- Implementations of `BlockSizeUser` ([#856])
15+
1316
[#849]: https://github.com/RustCrypto/hashes/pull/849
17+
[#856]: https://github.com/RustCrypto/hashes/pull/856
1418

1519
## 0.4.0 (2026-04-24)
1620
### Added

k12/src/custom/borrow.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use core::fmt;
22
use digest::{
33
CollisionResistance, ExtendableOutput, ExtendableOutputReset, HashMarker, Reset, Update,
4-
common::{AlgorithmName, BlockSizeUser},
5-
consts::{U16, U32, U136, U168},
4+
common::AlgorithmName,
5+
consts::{U16, U32},
66
};
77

88
use crate::{Kt, KtReader, utils::length_encode};
@@ -109,11 +109,3 @@ impl CollisionResistance for CustomRefKt128<'_> {
109109
impl CollisionResistance for CustomRefKt256<'_> {
110110
type CollisionResistance = U32;
111111
}
112-
113-
impl BlockSizeUser for CustomRefKt128<'_> {
114-
type BlockSize = U168;
115-
}
116-
117-
impl BlockSizeUser for CustomRefKt256<'_> {
118-
type BlockSize = U136;
119-
}

k12/src/custom/owned.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use core::fmt;
55
use digest::{
66
CollisionResistance, CustomizedInit, ExtendableOutput, ExtendableOutputReset, HashMarker,
77
Reset, Update,
8-
common::{AlgorithmName, BlockSizeUser},
9-
consts::{U16, U32, U136, U168},
8+
common::AlgorithmName,
9+
consts::{U16, U32},
1010
};
1111

1212
use crate::{Kt, KtReader, utils::length_encode};
@@ -122,11 +122,3 @@ impl CollisionResistance for CustomKt256 {
122122
// https://www.rfc-editor.org/rfc/rfc9861.html#section-7-8
123123
type CollisionResistance = U32;
124124
}
125-
126-
impl BlockSizeUser for CustomKt128 {
127-
type BlockSize = U168;
128-
}
129-
130-
impl BlockSizeUser for CustomKt256 {
131-
type BlockSize = U136;
132-
}

k12/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub use digest;
1313
use core::fmt;
1414
use digest::{
1515
CollisionResistance, ExtendableOutput, ExtendableOutputReset, HashMarker, Reset, Update,
16-
common::{AlgorithmName, BlockSizeUser},
17-
consts::{U16, U32, U136, U168},
16+
common::AlgorithmName,
17+
consts::{U16, U32},
1818
};
1919

2020
mod consts;
@@ -181,11 +181,3 @@ impl CollisionResistance for Kt128 {
181181
impl CollisionResistance for Kt256 {
182182
type CollisionResistance = U32;
183183
}
184-
185-
impl BlockSizeUser for Kt128 {
186-
type BlockSize = U168;
187-
}
188-
189-
impl BlockSizeUser for Kt256 {
190-
type BlockSize = U136;
191-
}

sha3/src/shake.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use digest::{
33
CollisionResistance, ExtendableOutput, ExtendableOutputReset, HashMarker, Reset, Update,
44
XofReader,
55
common::{
6-
AlgorithmName, BlockSizeUser,
6+
AlgorithmName,
77
hazmat::{DeserializeStateError, SerializableState, SerializedState},
88
},
9-
consts::{U16, U32, U136, U168, U201},
9+
consts::{U16, U32, U201},
1010
};
1111
use keccak::{Keccak, State1600};
1212
use sponge_cursor::SpongeCursor;
@@ -222,14 +222,7 @@ impl<const RATE: usize> Drop for ShakeReader<RATE> {
222222
impl CollisionResistance for Shake128 {
223223
type CollisionResistance = U16;
224224
}
225+
225226
impl CollisionResistance for Shake256 {
226227
type CollisionResistance = U32;
227228
}
228-
229-
impl BlockSizeUser for Shake128 {
230-
type BlockSize = U168;
231-
}
232-
233-
impl BlockSizeUser for Shake256 {
234-
type BlockSize = U136;
235-
}

turboshake/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Internal implementation by removing unnecessary buffering ([#849])
1111
- `Rate: BlockSizes` generic parameter to `const RATE: usize` ([#849])
1212

13+
### Removed
14+
- Implementations of `BlockSizeUser` ([#856])
15+
1316
[#849]: https://github.com/RustCrypto/hashes/pull/849
17+
[#856]: https://github.com/RustCrypto/hashes/pull/856
1418

1519
## 0.6.0 (2026-04-24)
1620
Note: the crate was transferred to RustCrypto from https://github.com/itzmeanjan/turboshake

turboshake/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use core::fmt;
1717
use digest::{
1818
CollisionResistance, ExtendableOutput, ExtendableOutputReset, HashMarker, Reset, Update,
1919
XofReader,
20-
common::{AlgorithmName, BlockSizeUser},
21-
consts::{U16, U32, U136, U168},
20+
common::AlgorithmName,
21+
consts::{U16, U32},
2222
};
2323

2424
/// Number of Keccak rounds used by TurboSHAKE.
@@ -211,11 +211,3 @@ impl<const DS: u8> CollisionResistance for TurboShake256<DS> {
211211
// https://www.ietf.org/archive/id/draft-irtf-cfrg-kangarootwelve-17.html#section-7-8
212212
type CollisionResistance = U32;
213213
}
214-
215-
impl<const DS: u8> BlockSizeUser for TurboShake128<DS> {
216-
type BlockSize = U168;
217-
}
218-
219-
impl<const DS: u8> BlockSizeUser for TurboShake256<DS> {
220-
type BlockSize = U136;
221-
}

0 commit comments

Comments
 (0)