pub struct MuBuilder { /* private fields */ }Expand description
Implements parts of Algorithm 2 and Line 6 of Algorithm 7 of FIPS 204.
Provides a stateful version of MLDSATrait::compute_mu_from_pk and MLDSATrait::compute_mu_from_tr
that supports streaming
large to-be-signed messages.
Note: this struct is only exposed for “pure” ML-DSA and not for HashML-DSA because HashML-DSA
does not benefit from allowing external construction of the message representative mu.
The same behaviour can be obtained by computing the pre-hash ph with the appropriate hash function
and providing that to HashMLDSA via PHSigner::sign_ph.
Implementations§
Source§impl MuBuilder
impl MuBuilder
Sourcepub fn compute_mu(
tr: &[u8; 64],
msg: &[u8],
ctx: Option<&[u8]>,
) -> Result<[u8; 64], SignatureError>
pub fn compute_mu( tr: &[u8; 64], msg: &[u8], ctx: Option<&[u8]>, ) -> Result<[u8; 64], SignatureError>
Algorithm 7 6: 𝜇 ← H(BytesToBits(𝑡𝑟)||𝑀′, 64)
Sourcepub fn do_init(
tr: &[u8; 64],
ctx: Option<&[u8]>,
) -> Result<Self, SignatureError>
pub fn do_init( tr: &[u8; 64], ctx: Option<&[u8]>, ) -> Result<Self, SignatureError>
This function requires the public key hash tr, which can be computed from the public key
using MLDSAPublicKeyTrait::compute_tr.
Trait Implementations§
Source§impl Suspendable<SUSPENDED_SHA3_STATE_LEN> for MuBuilder
If you are processing a large input message into ML-DSA and want to pause the operation
– maybe while waiting for slow network IO), you’ll need to use Suspendable.
Serialization of the state of an in-progress ML-DSA instance is really just serialization
of the construction of the message representative mu, since no other part of the ML-DSA algorithm
has a pausable state.
impl Suspendable<SUSPENDED_SHA3_STATE_LEN> for MuBuilder
If you are processing a large input message into ML-DSA and want to pause the operation
– maybe while waiting for slow network IO), you’ll need to use Suspendable.
Serialization of the state of an in-progress ML-DSA instance is really just serialization
of the construction of the message representative mu, since no other part of the ML-DSA algorithm
has a pausable state.