From 81ab75f719ff62d4b6e4fc9c75326dc3b191cbe7 Mon Sep 17 00:00:00 2001 From: Tom Wambsgans Date: Tue, 17 Mar 2026 11:24:00 +0100 Subject: [PATCH 1/5] lifetime_2_to_the_32 --- .../instantiations_aborting.rs | 98 ++++++++++++++++--- 1 file changed, 87 insertions(+), 11 deletions(-) diff --git a/src/signature/generalized_xmss/instantiations_aborting.rs b/src/signature/generalized_xmss/instantiations_aborting.rs index 2ca521b..b2b99d8 100644 --- a/src/signature/generalized_xmss/instantiations_aborting.rs +++ b/src/signature/generalized_xmss/instantiations_aborting.rs @@ -1,8 +1,84 @@ +/// Instantiations with Lifetime 2^32 +pub mod lifetime_2_to_the_32 { + + use crate::{ + inc_encoding::target_sum::TargetSumEncoding, + signature::generalized_xmss::{ + GeneralizedXMSSPublicKey, GeneralizedXMSSSignature, GeneralizedXMSSSignatureScheme, + }, + symmetric::{ + message_hash::aborting::AbortingHypercubeMessageHash, prf::shake_to_field::ShakePRFtoF, + tweak_hash::poseidon::PoseidonTweakHash, + }, + }; + + const LOG_LIFETIME: usize = 32; + + const DIMENSION: usize = 46; + const BASE: usize = 8; + const TARGET_SUM: usize = 200; + const Z: usize = 8; + const Q: usize = 127; + + const PARAMETER_LEN: usize = 5; + pub const TWEAK_LEN_FE: usize = 2; + const MSG_LEN_FE: usize = 9; + pub const RAND_LEN_FE: usize = 7; + pub const HASH_LEN_FE: usize = 8; + + const CAPACITY: usize = 9; + + type MH = AbortingHypercubeMessageHash< + PARAMETER_LEN, + RAND_LEN_FE, + HASH_LEN_FE, + DIMENSION, + BASE, + Z, + Q, + TWEAK_LEN_FE, + MSG_LEN_FE, + >; + type TH = PoseidonTweakHash; + type PRF = ShakePRFtoF; + type IE = TargetSumEncoding; + + pub type SIGTopLevelTargetSumLifetime32Dim64Base8 = + GeneralizedXMSSSignatureScheme; + pub type PubKeyTopLevelTargetSumLifetime32Dim64Base8 = GeneralizedXMSSPublicKey; + pub type SigTopLevelTargetSumLifetime32Dim64Base8 = GeneralizedXMSSSignature; + + #[cfg(test)] + mod test { + + #[cfg(feature = "slow-tests")] + use super::*; + #[cfg(feature = "slow-tests")] + use crate::signature::SignatureScheme; + + #[cfg(feature = "slow-tests")] + use crate::signature::test_templates::test_signature_scheme_correctness; + + #[test] + #[cfg(feature = "slow-tests")] + pub fn test_correctness() { + test_signature_scheme_correctness::( + 213, + 0, + SIGTopLevelTargetSumLifetime32Dim64Base8::LIFETIME as usize, + ); + test_signature_scheme_correctness::( + 4, + 0, + SIGTopLevelTargetSumLifetime32Dim64Base8::LIFETIME as usize, + ); + } + } +} + /// Instantiations with Lifetime 2^6. This is for testing purposes only. /// /// Warning: Should not be used in production environments. -/// -/// !!! TODO: compute properly each parameter. !!! pub mod lifetime_2_to_the_6 { use crate::{ inc_encoding::target_sum::TargetSumEncoding, @@ -17,7 +93,7 @@ pub mod lifetime_2_to_the_6 { // KoalaBear: p = 2^31 - 2^24 + 1 = 127 * 8^8 + 1 // w=8, z=8, Q=127, alpha=1 - const DIMENSION: usize = 64; + const DIMENSION: usize = 46; const BASE: usize = 8; const Z: usize = 8; const Q: usize = 127; @@ -27,7 +103,7 @@ pub mod lifetime_2_to_the_6 { const TWEAK_LEN_FE: usize = 2; const MSG_LEN_FE: usize = 9; const RAND_LEN_FE: usize = 7; - const MH_HASH_LEN_FE: usize = 8; + const HASH_LEN_FE: usize = 8; const TH_HASH_LEN_FE: usize = 8; const CAPACITY: usize = 9; @@ -35,7 +111,7 @@ pub mod lifetime_2_to_the_6 { type MH = AbortingHypercubeMessageHash< PARAMETER_LEN, RAND_LEN_FE, - MH_HASH_LEN_FE, + HASH_LEN_FE, DIMENSION, BASE, Z, @@ -50,7 +126,7 @@ pub mod lifetime_2_to_the_6 { type PRF = ShakePRFtoF; type IE = TargetSumEncoding; - pub type SIGAbortingLifetime6Dim64Base8 = + pub type SIGAbortingLifetime6Dim46Base8 = GeneralizedXMSSSignatureScheme; #[cfg(test)] @@ -59,19 +135,19 @@ pub mod lifetime_2_to_the_6 { SignatureScheme, test_templates::test_signature_scheme_correctness, }; - use super::SIGAbortingLifetime6Dim64Base8; + use super::SIGAbortingLifetime6Dim46Base8; #[test] pub fn test_correctness() { - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 2, 0, - SIGAbortingLifetime6Dim64Base8::LIFETIME as usize, + SIGAbortingLifetime6Dim46Base8::LIFETIME as usize, ); - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 11, 0, - SIGAbortingLifetime6Dim64Base8::LIFETIME as usize, + SIGAbortingLifetime6Dim46Base8::LIFETIME as usize, ); } } From a0e85553eccd7a4b0a836631110214c65a6c5026 Mon Sep 17 00:00:00 2001 From: Tom Wambsgans Date: Tue, 17 Mar 2026 11:24:49 +0100 Subject: [PATCH 2/5] fmt --- .../instantiations_poseidon_top_level.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/signature/generalized_xmss/instantiations_poseidon_top_level.rs b/src/signature/generalized_xmss/instantiations_poseidon_top_level.rs index 427eb19..1186e80 100644 --- a/src/signature/generalized_xmss/instantiations_poseidon_top_level.rs +++ b/src/signature/generalized_xmss/instantiations_poseidon_top_level.rs @@ -49,6 +49,7 @@ pub mod lifetime_2_to_the_18 { #[cfg(test)] mod test { + #[cfg(feature = "slow-tests")] use crate::signature::{ SignatureScheme, generalized_xmss::instantiations_poseidon_top_level::lifetime_2_to_the_18::SIGTopLevelTargetSumLifetime18Dim64Base8, @@ -133,7 +134,9 @@ pub mod lifetime_2_to_the_32 { #[cfg(test)] mod test { + #[cfg(feature = "slow-tests")] use super::*; + #[cfg(feature = "slow-tests")] use crate::signature::SignatureScheme; #[cfg(feature = "slow-tests")] @@ -209,7 +212,9 @@ pub mod lifetime_2_to_the_32 { #[cfg(test)] mod test { + #[cfg(feature = "slow-tests")] use super::*; + #[cfg(feature = "slow-tests")] use crate::signature::SignatureScheme; #[cfg(feature = "slow-tests")] @@ -284,7 +289,9 @@ pub mod lifetime_2_to_the_32 { #[cfg(test)] mod test { + #[cfg(feature = "slow-tests")] use super::*; + #[cfg(feature = "slow-tests")] use crate::signature::SignatureScheme; #[cfg(feature = "slow-tests")] @@ -364,11 +371,13 @@ pub mod lifetime_2_to_the_8 { #[cfg(test)] mod test { + #[cfg(feature = "slow-tests")] use crate::signature::SignatureScheme; #[cfg(feature = "slow-tests")] use crate::signature::test_templates::test_signature_scheme_correctness; + #[cfg(feature = "slow-tests")] use super::SIGTopLevelTargetSumLifetime8Dim64Base8; #[cfg(feature = "slow-tests")] From e612b2d6ef8ee0bc13f6a6ea43dccb802445ea4d Mon Sep 17 00:00:00 2001 From: Tom Wambsgans Date: Tue, 17 Mar 2026 13:11:44 +0100 Subject: [PATCH 3/5] fix --- src/signature/generalized_xmss/instantiations_aborting.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/signature/generalized_xmss/instantiations_aborting.rs b/src/signature/generalized_xmss/instantiations_aborting.rs index b2b99d8..2f4ffd1 100644 --- a/src/signature/generalized_xmss/instantiations_aborting.rs +++ b/src/signature/generalized_xmss/instantiations_aborting.rs @@ -120,7 +120,7 @@ pub mod lifetime_2_to_the_6 { MSG_LEN_FE, >; - const TARGET_SUM: usize = 230; // TODO + const TARGET_SUM: usize = 200; type TH = PoseidonTweakHash; type PRF = ShakePRFtoF; From 266d0fac7b8b3ca56a73b1111d3a0e52e2fe2e9e Mon Sep 17 00:00:00 2001 From: Tom Wambsgans Date: Thu, 19 Mar 2026 15:47:51 +0100 Subject: [PATCH 4/5] remove TODO / clean, in lifetime_2_to_the_6 --- .../generalized_xmss/instantiations_aborting.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/signature/generalized_xmss/instantiations_aborting.rs b/src/signature/generalized_xmss/instantiations_aborting.rs index 2f4ffd1..673fb2f 100644 --- a/src/signature/generalized_xmss/instantiations_aborting.rs +++ b/src/signature/generalized_xmss/instantiations_aborting.rs @@ -21,10 +21,10 @@ pub mod lifetime_2_to_the_32 { const Q: usize = 127; const PARAMETER_LEN: usize = 5; - pub const TWEAK_LEN_FE: usize = 2; + const TWEAK_LEN_FE: usize = 2; const MSG_LEN_FE: usize = 9; - pub const RAND_LEN_FE: usize = 7; - pub const HASH_LEN_FE: usize = 8; + const RAND_LEN_FE: usize = 7; + const HASH_LEN_FE: usize = 8; const CAPACITY: usize = 9; @@ -91,21 +91,18 @@ pub mod lifetime_2_to_the_6 { const LOG_LIFETIME: usize = 6; - // KoalaBear: p = 2^31 - 2^24 + 1 = 127 * 8^8 + 1 - // w=8, z=8, Q=127, alpha=1 const DIMENSION: usize = 46; const BASE: usize = 8; + const TARGET_SUM: usize = 200; const Z: usize = 8; const Q: usize = 127; - // TODO const PARAMETER_LEN: usize = 5; const TWEAK_LEN_FE: usize = 2; const MSG_LEN_FE: usize = 9; const RAND_LEN_FE: usize = 7; const HASH_LEN_FE: usize = 8; - const TH_HASH_LEN_FE: usize = 8; const CAPACITY: usize = 9; type MH = AbortingHypercubeMessageHash< @@ -120,10 +117,8 @@ pub mod lifetime_2_to_the_6 { MSG_LEN_FE, >; - const TARGET_SUM: usize = 200; - - type TH = PoseidonTweakHash; - type PRF = ShakePRFtoF; + type TH = PoseidonTweakHash; + type PRF = ShakePRFtoF; type IE = TargetSumEncoding; pub type SIGAbortingLifetime6Dim46Base8 = From 9c3830656ac3f5b72df44a4cde95fde3f7d9142d Mon Sep 17 00:00:00 2001 From: Tom Wambsgans Date: Sat, 21 Mar 2026 17:19:10 +0100 Subject: [PATCH 5/5] typo in naming --- .../instantiations_aborting.rs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/signature/generalized_xmss/instantiations_aborting.rs b/src/signature/generalized_xmss/instantiations_aborting.rs index 673fb2f..ddd5942 100644 --- a/src/signature/generalized_xmss/instantiations_aborting.rs +++ b/src/signature/generalized_xmss/instantiations_aborting.rs @@ -43,10 +43,10 @@ pub mod lifetime_2_to_the_32 { type PRF = ShakePRFtoF; type IE = TargetSumEncoding; - pub type SIGTopLevelTargetSumLifetime32Dim64Base8 = + pub type SIGAbortingTargetSumLifetime32Dim64Base8 = GeneralizedXMSSSignatureScheme; - pub type PubKeyTopLevelTargetSumLifetime32Dim64Base8 = GeneralizedXMSSPublicKey; - pub type SigTopLevelTargetSumLifetime32Dim64Base8 = GeneralizedXMSSSignature; + pub type PubKeyAbortingTargetSumLifetime32Dim64Base8 = GeneralizedXMSSPublicKey; + pub type SigAbortingTargetSumLifetime32Dim64Base8 = GeneralizedXMSSSignature; #[cfg(test)] mod test { @@ -62,15 +62,15 @@ pub mod lifetime_2_to_the_32 { #[test] #[cfg(feature = "slow-tests")] pub fn test_correctness() { - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 213, 0, - SIGTopLevelTargetSumLifetime32Dim64Base8::LIFETIME as usize, + SIGAbortingTargetSumLifetime32Dim64Base8::LIFETIME as usize, ); - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 4, 0, - SIGTopLevelTargetSumLifetime32Dim64Base8::LIFETIME as usize, + SIGAbortingTargetSumLifetime32Dim64Base8::LIFETIME as usize, ); } } @@ -121,7 +121,7 @@ pub mod lifetime_2_to_the_6 { type PRF = ShakePRFtoF; type IE = TargetSumEncoding; - pub type SIGAbortingLifetime6Dim46Base8 = + pub type SIGAbortingTargetSumLifetime6Dim46Base8 = GeneralizedXMSSSignatureScheme; #[cfg(test)] @@ -130,19 +130,19 @@ pub mod lifetime_2_to_the_6 { SignatureScheme, test_templates::test_signature_scheme_correctness, }; - use super::SIGAbortingLifetime6Dim46Base8; + use super::SIGAbortingTargetSumLifetime6Dim46Base8; #[test] pub fn test_correctness() { - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 2, 0, - SIGAbortingLifetime6Dim46Base8::LIFETIME as usize, + SIGAbortingTargetSumLifetime6Dim46Base8::LIFETIME as usize, ); - test_signature_scheme_correctness::( + test_signature_scheme_correctness::( 11, 0, - SIGAbortingLifetime6Dim46Base8::LIFETIME as usize, + SIGAbortingTargetSumLifetime6Dim46Base8::LIFETIME as usize, ); } }