From 130330909b69586de8b0e1b7490b91c033e4bf5e Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 20 May 2026 10:09:31 -0700 Subject: [PATCH] slh-dsa,xmss: replace sha3 with shake --- Cargo.lock | 14 ++------------ slh-dsa/Cargo.toml | 2 +- slh-dsa/src/hashes/shake.rs | 2 +- slh-dsa/src/hypertree.rs | 2 +- xmss/Cargo.toml | 2 +- xmss/src/hash.rs | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fecb9630..e47946b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1323,16 +1323,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha3" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be176f1a57ce4e3d31c1a166222d9768de5954f811601fb7ca06fc8203905ce1" -dependencies = [ - "digest", - "keccak", -] - [[package]] name = "shake" version = "0.1.0" @@ -1377,7 +1367,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "sha3", + "shake", "signature", "typenum", "zerocopy", @@ -1757,7 +1747,7 @@ dependencies = [ "serde_json", "serdect", "sha2", - "sha3", + "shake", "signature", "spki", "subtle", diff --git a/slh-dsa/Cargo.toml b/slh-dsa/Cargo.toml index fc61dc81..9cb850e6 100644 --- a/slh-dsa/Cargo.toml +++ b/slh-dsa/Cargo.toml @@ -23,7 +23,7 @@ hybrid-array = { version = "0.4", features = ["extra-sizes"] } pkcs8 = { version = "0.11", default-features = false } rand_core = "0.10" sha2 = { version = "0.11", default-features = false } -sha3 = { version = "0.11", default-features = false } +shake = { version = "0.1", default-features = false } signature = { version = "3", features = ["rand_core"] } typenum = { version = "1.20", features = ["const-generics"] } zerocopy = { version = "0.8", features = ["derive"] } diff --git a/slh-dsa/src/hashes/shake.rs b/slh-dsa/src/hashes/shake.rs index 46f20120..fac110e5 100644 --- a/slh-dsa/src/hashes/shake.rs +++ b/slh-dsa/src/hashes/shake.rs @@ -7,12 +7,12 @@ use crate::hypertree::HypertreeParams; use crate::wots::WotsParams; use crate::xmss::XmssParams; use crate::{ParameterSet, PkSeed, SkPrf, SkSeed}; +use ::shake::Shake256; use const_oid::db::fips205; use digest::{ExtendableOutput, Update}; use hybrid_array::typenum::consts::{U16, U30, U32}; use hybrid_array::typenum::{U24, U34, U39, U42, U47, U49}; use hybrid_array::{Array, ArraySize}; -use sha3::Shake256; use typenum::U; /// Implementation of the component hash functions using SHAKE256 diff --git a/slh-dsa/src/hypertree.rs b/slh-dsa/src/hypertree.rs index 488f3cc4..1212742c 100644 --- a/slh-dsa/src/hypertree.rs +++ b/slh-dsa/src/hypertree.rs @@ -209,7 +209,7 @@ mod tests { #[cfg(feature = "alloc")] fn test_ht_sign_kat() { use hex_literal::hex; - use sha3::{Shake256, digest::ExtendableOutput}; + use shake::{Shake256, digest::ExtendableOutput}; let sk_seed = SkSeed(Array([1; 16])); let pk_seed = PkSeed(Array([2; 16])); diff --git a/xmss/Cargo.toml b/xmss/Cargo.toml index c44c0247..3bb2c964 100644 --- a/xmss/Cargo.toml +++ b/xmss/Cargo.toml @@ -28,7 +28,7 @@ hybrid-array = { version = "0.4", features = ["zeroize"] } pkcs8 = { version = "0.11", optional = true, default-features = false, features = ["alloc"] } rand = "0.10" sha2 = "0.11" -sha3 = "0.11" +shake = "0.1" serdect = { version = "0.4", features = ["alloc"], optional = true } signature = "3" spki = { version = "0.8", optional = true, default-features = false, features = ["alloc"] } diff --git a/xmss/src/hash.rs b/xmss/src/hash.rs index 19574a37..ef417078 100644 --- a/xmss/src/hash.rs +++ b/xmss/src/hash.rs @@ -1,5 +1,5 @@ use sha2::{Digest, Sha256, Sha512}; -use sha3::{ +use shake::{ Shake128, Shake256, digest::{ExtendableOutput, Update, XofReader}, };