Skip to content

Commit cc17cc4

Browse files
committed
Mention availability of sign_internal API in example program
Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
1 parent a4ae235 commit cc17cc4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/ml_dsa_44.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ main()
5656

5757
ml_dsa_44::keygen(seed_span, pubkey_span, seckey_span);
5858
const bool has_signed = ml_dsa_44::sign(rnd_span, seckey_span, msg_span, ctx_span, sig_span);
59+
60+
// ML-DSA exposes an internal signing API, where one can pass an externally computed `mu` of 64 -bytes i.e. the message representative
61+
// to be signed, instead of passing message and optional context string. How is `mu` computed ?
62+
//
63+
// ```cpp
64+
// std::array<uint8_t, MU_BYTE_LEN> mu{};
65+
// auto mu_span = std::span(mu);
66+
//
67+
// shake256::shake256_t hasher;
68+
//
69+
// hasher.absorb(tr); // `tr` is hash of public key. It is embedded in the secret key.
70+
// hasher.absorb(domain_separator);
71+
// hasher.absorb(ctx);
72+
// hasher.absorb(msg);
73+
// hasher.finalize();
74+
//
75+
// hasher.squeeze(mu_span);
76+
// ```
77+
// const bool has_signed = ml_dsa_44::sign_internal(rnd_span, seckey_span, mu_span, sig_span);
78+
5979
const bool is_valid = ml_dsa_44::verify(pubkey_span, msg_span, ctx_span, sig_span);
6080

6181
std::cout << "ML-DSA-44 @ NIST security level 2\n";

0 commit comments

Comments
 (0)