diff --git a/ml-dsa/src/lib.rs b/ml-dsa/src/lib.rs index 75b2a07b..9dd92fe0 100644 --- a/ml-dsa/src/lib.rs +++ b/ml-dsa/src/lib.rs @@ -772,6 +772,21 @@ impl VerifyingKey

{ } } + /// Computes ยต according to FIPS 204 for use in ML-DSA.Sign and ML-DSA.Verify. + /// + /// # Errors + /// + /// Returns [`Error`] if the given `Mp` returns one. + pub fn compute_mu Result<(), Error>>( + &self, + Mp: F, + ctx: &[u8], + ) -> Result { + let mut mu = MuBuilder::new(&self.tr, ctx); + Mp(mu.as_mut())?; + Ok(mu.finish()) + } + /// This algorithm reflects the ML-DSA.Verify_internal algorithm from FIPS 204. It does not /// include the domain separator that distinguishes between the normal and pre-hashed cases, /// and it does not separate the context string from the rest of the message.