Skip to content

Commit 21384b5

Browse files
authored
Remove implementations of the VariableOutput trait (#744)
1 parent e048918 commit 21384b5

File tree

10 files changed

+34
-84
lines changed

10 files changed

+34
-84
lines changed

Cargo.lock

Lines changed: 24 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,4 @@ sha1 = { path = "sha1" }
3535
sha3 = { path = "sha3" }
3636
whirlpool = { path = "whirlpool" }
3737

38-
# https://github.com/RustCrypto/utils/pull/1187
39-
# https://github.com/RustCrypto/utils/pull/1207
40-
blobby = { git = "https://github.com/RustCrypto/utils" }
38+
digest = { git = "https://github.com/RustCrypto/traits" }

blake2/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Removed
1919
- `std` crate feature ([#678])
20+
- `Blake2bVar` and `Blake2sVar` types ([#744])
2021

2122
[#652]: https://github.com/RustCrypto/hashes/pull/652
2223
[#678]: https://github.com/RustCrypto/hashes/pull/678
24+
[#744]: https://github.com/RustCrypto/hashes/pull/744
2325

2426
## 0.10.6 (2022-12-16)
2527
### Added

blake2/README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,8 @@ Also, see the [examples section] in the RustCrypto/hashes readme.
4545

4646
### Variable output size
4747

48-
This implementation supports run and compile time variable sizes.
48+
This implementation supports output sizes variable at compile time:
4949

50-
Output size set at run time:
51-
```rust
52-
use blake2::Blake2bVar;
53-
use blake2::digest::{Update, VariableOutput};
54-
use hex_literal::hex;
55-
56-
let mut hasher = Blake2bVar::new(10).unwrap();
57-
hasher.update(b"my_input");
58-
let mut buf = [0u8; 10];
59-
hasher.finalize_variable(&mut buf).unwrap();
60-
assert_eq!(buf, hex!("2cc55c84e416924e6400"));
61-
```
62-
63-
Output size set at compile time:
6450
```rust
6551
use blake2::{Blake2b, Digest, digest::consts::U10};
6652
use hex_literal::hex;

blake2/src/lib.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ pub use digest::{self, Digest};
1515
use core::{fmt, marker::PhantomData, ops::Div};
1616
use digest::{
1717
CustomizedInit, FixedOutput, HashMarker, InvalidOutputSize, MacMarker, Output, Update,
18-
VarOutputCustomized,
1918
array::{Array, ArraySize},
2019
block_api::{
2120
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, OutputSizeUser, TruncSide,
22-
UpdateCore, VariableOutputCore,
21+
UpdateCore, VariableOutputCore, VariableOutputCoreCustomized,
2322
},
2423
block_buffer::{Lazy, LazyBuffer},
2524
consts::{U4, U16, U32, U64, U128},
@@ -80,12 +79,6 @@ where
8079
}
8180
}
8281

83-
digest::buffer_rt_variable!(
84-
/// BLAKE2b which allows to choose output size at runtime.
85-
pub struct Blake2bVar(Blake2bVarCore);
86-
exclude: SerializableState;
87-
);
88-
8982
/// BLAKE2b-128 hasher state.
9083
pub type Blake2b128 = Blake2b<U16>;
9184
/// BLAKE2b-256 hasher state.
@@ -134,12 +127,6 @@ where
134127
}
135128
}
136129

137-
digest::buffer_rt_variable!(
138-
/// BLAKE2s which allows to choose output size at runtime.
139-
pub struct Blake2sVar(Blake2sVarCore);
140-
exclude: SerializableState;
141-
);
142-
143130
/// BLAKE2s-128 hasher state.
144131
pub type Blake2s128 = Blake2s<U16>;
145132
/// BLAKE2s-256 hasher state.

blake2/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ macro_rules! blake2_impl {
257257
}
258258
}
259259

260-
impl VarOutputCustomized for $name {
260+
impl VariableOutputCoreCustomized for $name {
261261
#[inline]
262262
fn new_customized(customization: &[u8], output_size: usize) -> Self {
263263
Self::new_with_params(&[], customization, 0, output_size)

blake2/tests/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#[cfg(feature = "reset")]
2-
use digest::dev::{fixed_reset_test as fixed_test, variable_reset_test as variable_test};
2+
use digest::dev::fixed_reset_test as fixed_test;
33
#[cfg(not(feature = "reset"))]
4-
use digest::dev::{fixed_test, variable_test};
4+
use digest::dev::fixed_test;
55
use digest::new_test;
66

77
new_test!(blake2b_kat, blake2::Blake2b512, fixed_test);
8-
new_test!(blake2b_variable_kat, blake2::Blake2bVar, variable_test);
9-
new_test!(blake2s_variable_kat, blake2::Blake2sVar, variable_test);

groestl/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Removed
2020
- `std` crate feature ([#678])
21+
- `GroestlShortVar` and `GroestlLongVar` types ([#744])
2122

2223
[#652]: https://github.com/RustCrypto/hashes/pull/652
2324
[#678]: https://github.com/RustCrypto/hashes/pull/678
2425
[#716]: https://github.com/RustCrypto/hashes/pull/716
26+
[#744]: https://github.com/RustCrypto/hashes/pull/744
2527

2628
## 0.10.1 (2022-02-17)
2729
### Fixed

groestl/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ digest::buffer_ct_variable!(
2424
pub struct GroestlShort<OutSize>(block_api::GroestlShortVarCore);
2525
max_size: U32;
2626
);
27-
digest::buffer_rt_variable!(
28-
/// Long Groestl variant which allows to select output size at runtime.
29-
pub struct GroestlShortVar(block_api::GroestlShortVarCore);
30-
);
3127
digest::buffer_ct_variable!(
3228
/// Long Groestl variant generic over output size.
3329
pub struct GroestlLong<OutSize>(block_api::GroestlLongVarCore);
3430
max_size: U64;
3531
);
36-
digest::buffer_rt_variable!(
37-
/// Long Groestl variant which allows to select output size at runtime.
38-
pub struct GroestlLongVar(block_api::GroestlLongVarCore);
39-
);
4032

4133
/// Groestl-224 hasher.
4234
pub type Groestl224 = GroestlShort<U28>;

kupyna/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ digest::buffer_ct_variable!(
2424
pub struct KupynaShort<OutSize>(block_api::KupynaShortVarCore);
2525
max_size: U32;
2626
);
27-
digest::buffer_rt_variable!(
28-
/// Short Kupyna variant which allows to select output size at runtime.
29-
pub struct KupynaShortVar(block_api::KupynaShortVarCore);
30-
);
3127
digest::buffer_ct_variable!(
3228
/// Long Kupyna variant generic over output size.
3329
pub struct KupynaLong<OutSize>(block_api::KupynaLongVarCore);
3430
max_size: U64;
3531
);
36-
digest::buffer_rt_variable!(
37-
/// Long Kupyna variant which allows to select output size at runtime.
38-
pub struct KupynaLongVar(block_api::KupynaLongVarCore);
39-
);
4032

4133
/// Kupyna-224 hasher.
4234
pub type Kupyna224 = KupynaShort<U28>;

0 commit comments

Comments
 (0)