Documentation

CslibFrontier.Crypto.Computational.MLDSA.PublicKeyHash

The public-key hash in seeded ML-DSA #

In FIPS 204, Algorithm 6, the SHAKE256 calls that determine the public key have 34-byte and 66-byte inputs. The final hash reads the encoded public key itself. Its length is different from both earlier input lengths at every FIPS level. We use this distinction on the actual finite random table, retaining the dependence of the encoded key on the short reads. The independence law and its public-key-prefix bound are original deductions for this game.

theorem Cslib.Crypto.MLDSA.FIPS204.uniformPrefixes_publicKeyHash (base : Xofs) (s : Level) (seed : FixedBytes 32) {a b : ℕ} (ha : 8 * (32 + 320 * s.params.k) ≤ a) (hb : 64 ≤ b) :
PMF.map (fun (H : Xofs) => Option.map (fun (keys : KeyPair) => (keys.publicKey, H.h256.readBytes keys.publicKey 64)) (H.keyGen s seed)) (base.uniformPrefixes a b) = (base.uniformPrefixes a b).bind fun (H : Xofs) => PMF.map (fun (v : FixedBytes 64) => Option.map (fun (keys : KeyPair) => (keys.publicKey, v.toList)) (H.keyGen s seed)) (Probability.PMF.uniformOfFintype (FixedBytes 64))

In the finite ideal-XOF experiment, the public key obtained from Algorithm 6 and its 64-byte hash have exactly the law of the same optional public key paired on success with an independent uniform 64-byte string. This holds for every fixed 32-byte key-generation seed and retains the probability of Appendix C setup failure.

theorem Cslib.Crypto.MLDSA.FIPS204.uniformPrefixes_publicKeyPrefix_le (base : Xofs) (s : Level) {a b : ℕ} (ha : 8 * (32 + 320 * s.params.k) ≤ a) (hb : 64 ≤ b) :
((base.uniformPrefixes a b).bind fun (H : Xofs) => H.keyExperiment s fun (keys : KeyPair) => PMF.pure (decide (H.h256.readBytes keys.publicKey 64 = List.take 64 keys.publicKey))) true ≤ (2 ^ 512)⁻¹

Under the actual seeded key-generation law on the finite ideal streams, the probability of successful setup with the first 64 public-key bytes equal to its SHAKE256 hash is at most 2⁻⁵¹². The random table widths are fixed before drawing the key-generation seed.