ML-DSA verification on byte keys and signatures #
FIPS 204, Algorithms 3, 6 and 8, with the Appendix C output limits for SHAKE
rejection sampling. Verification distinguishes a malformed signature (some false) from XOF
exhaustion (none). The signing digest and the challenge polynomial have distinct types.
The ring products use the coefficient form of Algorithm 8, line 9.
The key-only reduction retains the matrix seed and the verifier's SHAKE-derived message
representative. Its setup samples the Algorithm 6 key-generation seed. The resulting
self-target experiment has that same seeded setup. For challenges supplying a full vector and a
matrix at the published seed, decode_encodePublic recovers the rounded high term, and
verifiedSignature_of_verifyWithExpansion recovers the full digest check for that vector.
XOFs and parameter levels #
The two XOFs used by FIPS 204. Each SHAKE variant has a single raw-bit input space, shared by key generation, signing, verification and external queries.
- h128 : ExtendableOutput
The XOF used to expand the public matrix.
- h256 : ExtendableOutput
The XOF used for secret expansion, masks, message representatives and challenges.
FIPS 202 instantiation of the two FIPS 204 XOFs.
SHAKE256 evaluation in the FIPS 202 instantiation uses the four-one domain-separation suffix.
Ring and shortness parameters for the selected standard parameter set.
Each FIPS parameter set satisfies the ring, challenge and rounding conditions.
Byte length of the commitment digest (FIPS 204, Table 1, 2λ bits).
Maximum Hamming weight of the complete hint vector (Table 1).
A coefficient polynomial in the FIPS 204 negacyclic ring.
The coefficient representation of the public module matrix for the selected parameter set.
Coefficient bit-packing #
Matrix expansion (Algorithms 30 and 32) #
FIPS 204 Algorithm 14 reads the low 23 bits of three little-endian bytes.
Exhaustion occurs exactly when fewer than 256 coefficients were accepted.
The sampled NTT vector consists of the first 256 accepted coefficients in stream order.
Reverse the eight bits of the FIPS evaluation index (§§2.5 and 7.5).
The coefficient of degree j in the inverse NTT, using the evaluation points
ζ^(2 BitRev8(i)+1) (FIPS 204 §2.5, equation (2.1)). The inverse of 256 modulo q is 8347681.
Algorithms 30 and 32, returning the matrix in coefficient representation. Each SHAKE128
stream absorbs ρ || column || row and may consume 894 bytes (Appendix C, Table 3).
FIPS 202 specialization of Xofs.expandA.
Secret vector expansion (Algorithms 31 and 33) #
The two counter bytes absorbed by Algorithms 33 and 34, least significant byte first.
A nonce-tagged 64-byte expansion seed occupies 528 SHAKE input bits.
For a fixed seed, the two-byte little-endian suffix recovers any counter below 65536.
An Algorithm 34 mask row has a 64-byte seed and two counter bytes. It cannot alias the SHAKE input at the 32-, 48-, or 64-byte digest consumed by Algorithm 29.
Key encodings and key generation (Algorithm 6) #
The seed used to expand the matrix can be read from the published bytes.
The signed field round trip, even when other fields follow it in the input.
The six fields of the FIPS 204 private-key encoding (Algorithms 24 and 25).
The seed for the public matrix.
The secret signing seed.
The public-key hash.
The short secret vector.
The short error vector.
The low public vector from Power2Round.
Algorithm 25 decodes the stored private-key fields from their fixed-width encodings.
Raw SHAKE256 input of FIPS 204 Algorithm 6, line 1. The 32-byte seed is followed by the one-byte matrix dimensions in row then column order.
The Algorithm 6 key expansion uses a 272-bit input at each standardized level.
Algorithm 6 reads the public matrix seed, the short-vector seed and the signing key in one 128-byte SHAKE256 expansion of the seed and the two dimension bytes.
FIPS 204 Algorithm 33 samples both short vectors from SHAKE256. The nonces of the error vector start immediately after the last nonce of the secret vector.
Algorithm 6, from the 32-byte seed to both encoded keys (Algorithms 22, 24). Rejection exhaustion during the matrix or short-vector expansion yields an error.
Algorithm 6 gives the same keys or failure when the matrix stream, key expansion, secret-vector nonce reads at the generated secret seed, and encoded-public-key hash reads agree.
The seed recovered from a successful public key is precisely the prefix used to index the SHAKE128 matrix streams during this execution of Algorithm 6.
Algorithm 6 is unchanged if SHAKE128 is unchanged and the two SHAKE256 streams agree on all words outside the parameter set's digest-seed length. The key-seed input is 34 bytes, secret nonce inputs are 66 bytes, and every encoded public key is longer than a digest.
FIPS 202 specialization of Xofs.keyGen.
A generated private key decodes to the same matrix seed, last 32 key-expansion bytes, short vectors, public-key hash and rounded low part used by Algorithm 6.
The encoded public key from Algorithm 6.
Challenge sampling (Algorithm 29) #
Algorithm 29. Preload the last τ positions with the SHAKE sign bits and exchange each with its chosen position in increasing order. Future sign positions remain untouched because an accepted index is at most the current position. The caller supplies the SHAKE256 bytes. The FIPS wrapper below chooses the minimum permitted 221-byte bound from Appendix C, Table 3.
FIPS 202 specialization of Xofs.sampleInBall.
Hints and signature encoding (Algorithms 21, 26, and 27) #
The components of a FIPS 204 signature after Algorithm 27 has checked its encoding.
The complete λ/4-byte commitment hash.
The response polynomials decoded from their signed range.
The decoded hint bits.
FIPS 204 Algorithms 21 and 27 give each successfully decoded signature exactly one byte representation. The hint rows determine their cumulative ends and their zero padding.
Consecutive little-endian bytes in a commitment digest register.
A coherent commitment digest register supplies exactly the required number of bytes.
A literal digest of the prescribed length round-trips through the XOR register.
Length in bytes of an encoded signature (FIPS 204, Table 2).
Encoding a signature satisfying the hint and digest bounds has its prescribed length.
Algorithms 26 and 27 round-trip every signature with the prescribed digest length,
an accepted response norm, and at most ω hint bits.
Public-key decoding #
Decode the rounded public coefficients and lift them by the FIPS factor 2^13.
Public-key decoding retains the matrix obtained from the published seed.
Decoding the public-key bytes recovers the dilated high vector 2^13 t₁ coefficientwise,
including the upper endpoint 1023 in the ten-bit encoding.
Message representatives and commitment inputs #
FIPS 202 specialization of Xofs.representativeFromTr.
FIPS 202 specialization of Xofs.messageRepresentative.
Bit length of the 512-bit representative followed by FIPS 204's packed high bits. It is 6656 at ML-DSA-44 and -65, and 8704 at ML-DSA-87.
The two SHAKE256 inputs in the FIPS challenge computation have different lengths: the 512-bit message representative is followed by a nonempty packed commitment, whereas the digest seed for Algorithm 29 occupies at most 512 bits.
Unpacking the canonical FIPS address recovers each bounded high-bit coefficient.
Fixed-width packing distinguishes all high-bit vectors in the range of UseHint.
Verification (Algorithms 3 and 8) #
Equal 512-bit representatives give equal full SHAKE256 outputs at the two raw inputs.
On the contexts allowed by Algorithm 3, the pure-mode prefix determines both the external context and the entire bit-string message, including a final incomplete byte.
Algorithm 3 with the public matrix expansion supplied at its call site. The context and signature checks, message hashing, challenge expansion, and full digest comparison are shared with the concrete verifier.
Acceptance by Xofs.verifyWithExpansion implies the Algorithm 3 context length bound.
On freshly encoded public bytes, the verifier reads exactly the published seed. Once its matrix has been obtained from the shared oracle it can be reused in the digest check.
Pure ML-DSA verification (Algorithm 3): format the context and the bit-string message, then run Algorithm 8. Contexts longer than 255 bytes return the specified error.
The two verifiers return the same Boolean or error if their matrix, bounded sparse challenge, message representative and final commitment digest agree. The representative needs to agree only for a well-formed context and public-key length.
The byte-level forger chooses the context, message, and signature after seeing only the published key.
External context of at most 255 bytes for an accepted forgery.
Original bit-string message.
Byte encoding of the purported signature.
Algorithm 3 frames the context before the bit-string message.
Acceptance by the byte verifier at a supplied matrix A, including the context and key
length bounds, signature decoding, challenge expansion, response shortness, and full
commitment-digest equality.
A verifying byte string determines a short response and the precise digest equality for the public vector decoded from the bytes. The calculation needs only that key and its matrix.
A successful byte verification on a published (ρ,t₁) determines the parsed signature,
its sparse challenge, the response bound, and the complete FIPS digest equality, expressed
using the rounded high term of the original full vector t.
Positive verification direction for an encoded public key and the verifier's exact digest check. This also covers fixed, externally supplied matrix expansions.
Self-target witness extraction and reduction #
Extraction for a full challenge (A,t). The published bytes and message representative
use the rounded key, while the witness computed from the full key includes the term c t₀
in the low vector (Dilithium v3.1, §6.2.1, equation (10)).
Check a corrected short witness on the original raw FIPS streams. Recover the complete commitment digest only when the representative is 512 bits, the product is on the commitment grid, the low part and response obey the extraction bound, and Algorithm 29 returns the witness challenge. An exhausted expansion fails the check.
A raw opening is equivalent to a short-vector solution on the canonical grid, with the exact commitment digest and a successful sparse expansion at that digest.
An accepting byte signature gives a short witness whose raw opening recovers exactly the digest bytes in that signature. The matrix at the public seed and the full public vector are those of the lattice pair supplied to the extractor.
Every accepted byte forgery yields a solution on the full vector supplied by the challenge.
For each fixed published byte key, the solver parses the forgery and extracts a self-target candidate. The hash input contains its actual public-key-bound message representative.
Self-target acceptance for a solver on a published byte key. The experiment constructs its own challenge matrix from that key's seed and rounded coefficients.
Acceptance by the FIPS byte verifier implies self-target acceptance for the extracted candidate on the same published key, including its matrix seed.
The finite success bound under the Algorithm 6 seed law and Algorithm 3 verification. The right-hand game tests the actual extracted candidate under that same seeded public key. Replacing this seeded target by standard uniform-matrix hardness is a separate reduction.
Expand an oracle's fixed-length commitment digest by Algorithm 29, including XOF exhaustion at the Appendix C limit.
Classical self-target forking for the three FIPS parameter sets, in the model where a fresh commitment query returns a uniform digest. Algorithm 29 acts on those digest bytes. The collision term is the largest distinct-digest collision probability of the fixed SHAKE256 expansion; the library gives it only the trivial bound of one.