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.
You can get the same behaviour by computing the pre-hash ph with the appropriate hash function
and providing that to HashMLDSA via PHSignature::sign_ph.
Implementations§
Source§impl MuBuilder
impl MuBuilder
Sourcepub fn compute_mu(
msg: &[u8],
ctx: Option<&[u8]>,
tr: &[u8; 64],
) -> Result<[u8; 64], SignatureError>
pub fn compute_mu( msg: &[u8], ctx: Option<&[u8]>, tr: &[u8; 64], ) -> 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.
Auto Trait Implementations§
impl Freeze for MuBuilder
impl RefUnwindSafe for MuBuilder
impl Send for MuBuilder
impl Sync for MuBuilder
impl Unpin for MuBuilder
impl UnsafeUnpin for MuBuilder
impl UnwindSafe for MuBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more