Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 24 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,4 @@ sha1 = { path = "sha1" }
sha3 = { path = "sha3" }
whirlpool = { path = "whirlpool" }

# https://github.com/RustCrypto/utils/pull/1187
# https://github.com/RustCrypto/utils/pull/1207
blobby = { git = "https://github.com/RustCrypto/utils" }
digest = { git = "https://github.com/RustCrypto/traits" }
2 changes: 2 additions & 0 deletions blake2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- `std` crate feature ([#678])
- `Blake2bVar` and `Blake2sVar` types ([#744])

[#652]: https://github.com/RustCrypto/hashes/pull/652
[#678]: https://github.com/RustCrypto/hashes/pull/678
[#744]: https://github.com/RustCrypto/hashes/pull/744

## 0.10.6 (2022-12-16)
### Added
Expand Down
16 changes: 1 addition & 15 deletions blake2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,8 @@ Also, see the [examples section] in the RustCrypto/hashes readme.

### Variable output size

This implementation supports run and compile time variable sizes.
This implementation supports output sizes variable at compile time:

Output size set at run time:
```rust
use blake2::Blake2bVar;
use blake2::digest::{Update, VariableOutput};
use hex_literal::hex;

let mut hasher = Blake2bVar::new(10).unwrap();
hasher.update(b"my_input");
let mut buf = [0u8; 10];
hasher.finalize_variable(&mut buf).unwrap();
assert_eq!(buf, hex!("2cc55c84e416924e6400"));
```

Output size set at compile time:
```rust
use blake2::{Blake2b, Digest, digest::consts::U10};
use hex_literal::hex;
Expand Down
15 changes: 1 addition & 14 deletions blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ pub use digest::{self, Digest};
use core::{fmt, marker::PhantomData, ops::Div};
use digest::{
CustomizedInit, FixedOutput, HashMarker, InvalidOutputSize, MacMarker, Output, Update,
VarOutputCustomized,
array::{Array, ArraySize},
block_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, OutputSizeUser, TruncSide,
UpdateCore, VariableOutputCore,
UpdateCore, VariableOutputCore, VariableOutputCoreCustomized,
},
block_buffer::{Lazy, LazyBuffer},
consts::{U4, U16, U32, U64, U128},
Expand Down Expand Up @@ -80,12 +79,6 @@ where
}
}

digest::buffer_rt_variable!(
/// BLAKE2b which allows to choose output size at runtime.
pub struct Blake2bVar(Blake2bVarCore);
exclude: SerializableState;
);

/// BLAKE2b-128 hasher state.
pub type Blake2b128 = Blake2b<U16>;
/// BLAKE2b-256 hasher state.
Expand Down Expand Up @@ -134,12 +127,6 @@ where
}
}

digest::buffer_rt_variable!(
/// BLAKE2s which allows to choose output size at runtime.
pub struct Blake2sVar(Blake2sVarCore);
exclude: SerializableState;
);

/// BLAKE2s-128 hasher state.
pub type Blake2s128 = Blake2s<U16>;
/// BLAKE2s-256 hasher state.
Expand Down
2 changes: 1 addition & 1 deletion blake2/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ macro_rules! blake2_impl {
}
}

impl VarOutputCustomized for $name {
impl VariableOutputCoreCustomized for $name {
#[inline]
fn new_customized(customization: &[u8], output_size: usize) -> Self {
Self::new_with_params(&[], customization, 0, output_size)
Expand Down
6 changes: 2 additions & 4 deletions blake2/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#[cfg(feature = "reset")]
use digest::dev::{fixed_reset_test as fixed_test, variable_reset_test as variable_test};
use digest::dev::fixed_reset_test as fixed_test;
#[cfg(not(feature = "reset"))]
use digest::dev::{fixed_test, variable_test};
use digest::dev::fixed_test;
use digest::new_test;

new_test!(blake2b_kat, blake2::Blake2b512, fixed_test);
new_test!(blake2b_variable_kat, blake2::Blake2bVar, variable_test);
new_test!(blake2s_variable_kat, blake2::Blake2sVar, variable_test);
2 changes: 2 additions & 0 deletions groestl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- `std` crate feature ([#678])
- `GroestlShortVar` and `GroestlLongVar` types ([#744])

[#652]: https://github.com/RustCrypto/hashes/pull/652
[#678]: https://github.com/RustCrypto/hashes/pull/678
[#716]: https://github.com/RustCrypto/hashes/pull/716
[#744]: https://github.com/RustCrypto/hashes/pull/744

## 0.10.1 (2022-02-17)
### Fixed
Expand Down
8 changes: 0 additions & 8 deletions groestl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ digest::buffer_ct_variable!(
pub struct GroestlShort<OutSize>(block_api::GroestlShortVarCore);
max_size: U32;
);
digest::buffer_rt_variable!(
/// Long Groestl variant which allows to select output size at runtime.
pub struct GroestlShortVar(block_api::GroestlShortVarCore);
);
digest::buffer_ct_variable!(
/// Long Groestl variant generic over output size.
pub struct GroestlLong<OutSize>(block_api::GroestlLongVarCore);
max_size: U64;
);
digest::buffer_rt_variable!(
/// Long Groestl variant which allows to select output size at runtime.
pub struct GroestlLongVar(block_api::GroestlLongVarCore);
);

/// Groestl-224 hasher.
pub type Groestl224 = GroestlShort<U28>;
Expand Down
8 changes: 0 additions & 8 deletions kupyna/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ digest::buffer_ct_variable!(
pub struct KupynaShort<OutSize>(block_api::KupynaShortVarCore);
max_size: U32;
);
digest::buffer_rt_variable!(
/// Short Kupyna variant which allows to select output size at runtime.
pub struct KupynaShortVar(block_api::KupynaShortVarCore);
);
digest::buffer_ct_variable!(
/// Long Kupyna variant generic over output size.
pub struct KupynaLong<OutSize>(block_api::KupynaLongVarCore);
max_size: U64;
);
digest::buffer_rt_variable!(
/// Long Kupyna variant which allows to select output size at runtime.
pub struct KupynaLongVar(block_api::KupynaLongVarCore);
);

/// Kupyna-224 hasher.
pub type Kupyna224 = KupynaShort<U28>;
Expand Down
Loading