From a622520951280c7aea291c3d9b7a00d3721f5531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 Oct 2025 15:30:13 +0300 Subject: [PATCH 1/4] Remove implementations of the `VariableOutput` trait --- Cargo.lock | 51 +++++++++++++++++++------------------------- Cargo.toml | 4 +--- blake2/CHANGELOG.md | 1 + blake2/README.md | 16 +------------- blake2/src/lib.rs | 15 +------------ blake2/src/macros.rs | 2 +- blake2/tests/mod.rs | 6 ++---- groestl/CHANGELOG.md | 1 + groestl/src/lib.rs | 8 ------- kupyna/src/lib.rs | 8 ------- 10 files changed, 30 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59b1ea3d5..1e056d0af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,9 +56,9 @@ dependencies = [ [[package]] name = "blobby" -version = "0.4.0-pre.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4db6eec520c1f3d3b060c5b67527c3d1d4122d9f0ff47edf0149a7ffa34cebb" +checksum = "89af0b093cc13baa4e51e64e65ec2422f7e73aea0e612e5ad3872986671622f1" [[package]] name = "block-buffer" @@ -72,9 +72,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "const-oid" @@ -94,8 +94,7 @@ dependencies = [ [[package]] name = "crypto-common" version = "0.2.0-rc.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8235645834fbc6832939736ce2f2d08192652269e11010a6240f61b908a1c6" +source = "git+https://github.com/RustCrypto/traits?branch=digest%2Frm_rt_variable#7d949345d72ce3cbdf3948705816188f7e3d3987" dependencies = [ "hybrid-array", ] @@ -103,8 +102,7 @@ dependencies = [ [[package]] name = "digest" version = "0.11.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac89f8a64533a9b0eaa73a68e424db0fb1fd6271c74cc0125336a05f090568d" +source = "git+https://github.com/RustCrypto/traits?branch=digest%2Frm_rt_variable#7d949345d72ce3cbdf3948705816188f7e3d3987" dependencies = [ "blobby", "block-buffer", @@ -156,9 +154,9 @@ checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" [[package]] name = "hybrid-array" -version = "0.4.0" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe39a812f039072707ce38020acbab2f769087952eddd9e2b890f37654b2349" +checksum = "f471e0a81b2f90ffc0cb2f951ae04da57de8baa46fa99112b062a5173a5088d0" dependencies = [ "typenum", ] @@ -202,9 +200,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.175" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "md-5" @@ -254,9 +252,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] @@ -364,9 +362,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.106" +version = "2.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b" dependencies = [ "proc-macro2", "quote", @@ -393,15 +391,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] name = "whirlpool" @@ -414,18 +412,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", @@ -437,8 +435,3 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" - -[[patch.unused]] -name = "blobby" -version = "0.4.0-pre.0" -source = "git+https://github.com/RustCrypto/utils#8fd37074861e2d8e400a53d68e10ce713944fa65" diff --git a/Cargo.toml b/Cargo.toml index 5ad5baf6e..5ca561814 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,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", branch = "digest/rm_rt_variable" } diff --git a/blake2/CHANGELOG.md b/blake2/CHANGELOG.md index d3a61634e..f2229f3bc 100644 --- a/blake2/CHANGELOG.md +++ b/blake2/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - `std` crate feature ([#678]) +- `Blake2bVar` and `Blake2sVar` types [#652]: https://github.com/RustCrypto/hashes/pull/652 [#678]: https://github.com/RustCrypto/hashes/pull/678 diff --git a/blake2/README.md b/blake2/README.md index b6b2e14ca..8e4c3e9e4 100644 --- a/blake2/README.md +++ b/blake2/README.md @@ -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; diff --git a/blake2/src/lib.rs b/blake2/src/lib.rs index 0a352f192..54b621608 100644 --- a/blake2/src/lib.rs +++ b/blake2/src/lib.rs @@ -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}, @@ -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; /// BLAKE2b-256 hasher state. @@ -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; /// BLAKE2s-256 hasher state. diff --git a/blake2/src/macros.rs b/blake2/src/macros.rs index a29fcdd2c..a5d0af50c 100644 --- a/blake2/src/macros.rs +++ b/blake2/src/macros.rs @@ -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) diff --git a/blake2/tests/mod.rs b/blake2/tests/mod.rs index 2a804b396..e3988bdcb 100644 --- a/blake2/tests/mod.rs +++ b/blake2/tests/mod.rs @@ -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); diff --git a/groestl/CHANGELOG.md b/groestl/CHANGELOG.md index 402f3f318..ffb347adc 100644 --- a/groestl/CHANGELOG.md +++ b/groestl/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - `std` crate feature ([#678]) +- `GroestlShortVar` and `GroestlLongVar` types [#652]: https://github.com/RustCrypto/hashes/pull/652 [#678]: https://github.com/RustCrypto/hashes/pull/678 diff --git a/groestl/src/lib.rs b/groestl/src/lib.rs index 8d6aad8e2..95f5a6160 100644 --- a/groestl/src/lib.rs +++ b/groestl/src/lib.rs @@ -24,19 +24,11 @@ digest::buffer_ct_variable!( pub struct GroestlShort(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(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; diff --git a/kupyna/src/lib.rs b/kupyna/src/lib.rs index d605de300..f370ce553 100644 --- a/kupyna/src/lib.rs +++ b/kupyna/src/lib.rs @@ -24,19 +24,11 @@ digest::buffer_ct_variable!( pub struct KupynaShort(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(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; From 30cc0f06831a5b0897ef4a83167c2a7364603374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 Oct 2025 15:36:48 +0300 Subject: [PATCH 2/4] update changelog links --- blake2/CHANGELOG.md | 3 ++- groestl/CHANGELOG.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/blake2/CHANGELOG.md b/blake2/CHANGELOG.md index f2229f3bc..bd478a3f5 100644 --- a/blake2/CHANGELOG.md +++ b/blake2/CHANGELOG.md @@ -17,10 +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 +- `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 diff --git a/groestl/CHANGELOG.md b/groestl/CHANGELOG.md index ffb347adc..fd9da0a95 100644 --- a/groestl/CHANGELOG.md +++ b/groestl/CHANGELOG.md @@ -18,11 +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 +- `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 From 803c4f95e5c84fc5d134e33cd0ec8c771d45a878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 24 Oct 2025 16:53:27 +0300 Subject: [PATCH 3/4] Update Cargo.lock --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c219168d..301425d36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,9 +259,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -378,9 +378,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.107" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", From 5410cd46977347b6ec9fa56176448b271095248c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 24 Oct 2025 16:54:21 +0300 Subject: [PATCH 4/4] Use `digest` from the master branch --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 301425d36..b00981498 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,7 +110,7 @@ dependencies = [ [[package]] name = "crypto-common" version = "0.2.0-rc.4" -source = "git+https://github.com/RustCrypto/traits?branch=digest%2Frm_rt_variable#7d949345d72ce3cbdf3948705816188f7e3d3987" +source = "git+https://github.com/RustCrypto/traits#b0d40cd1ae3f4adf07769436e661434f6333816c" dependencies = [ "hybrid-array", ] @@ -118,7 +118,7 @@ dependencies = [ [[package]] name = "digest" version = "0.11.0-rc.3" -source = "git+https://github.com/RustCrypto/traits?branch=digest%2Frm_rt_variable#7d949345d72ce3cbdf3948705816188f7e3d3987" +source = "git+https://github.com/RustCrypto/traits#b0d40cd1ae3f4adf07769436e661434f6333816c" dependencies = [ "blobby", "block-buffer", diff --git a/Cargo.toml b/Cargo.toml index f4387e96c..bf29f817f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,4 +35,4 @@ sha1 = { path = "sha1" } sha3 = { path = "sha3" } whirlpool = { path = "whirlpool" } -digest = { git = "https://github.com/RustCrypto/traits", branch = "digest/rm_rt_variable" } +digest = { git = "https://github.com/RustCrypto/traits" }