Repository navigation
PPC64LE FFDH parameter candidates: the generator's congruence from the digit sum - #4677
Merged
Merged
Conversation
This was referenced Nov 8, 2026
|
This pull request has conflicts with Posted by |
…e digit sum residue no longer reduces p bit-serially modulo 24 or 10 (about ten instructions per bit of p, on every candidate). p modulo 8 is its low digit's; p modulo 3 or 5 is the sum of its 32-bit digits' (2^32 ≡ 1), reduced by a multiplication by the divisor's reciprocal (mulhdu), exact for every 64-bit sum (mod3_bv, mod5_bv). Search's smallMod, trial and sieve, and their proofs, are no longer used, and are deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHGTYqNsecxgCdT9ZaD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHGTYqNsecxgCdT9ZaD
alex
force-pushed
the
claude/ppc64le-ffdh-residue
branch
from
November 8, 2026 20:22
14275dd to
80ce837
Compare
alex
marked this pull request as ready for review
November 8, 2026 20:22
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHGTYqNsecxgCdT9ZaD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #4660 (merged). This is the second step on finding 3 of the PPC64LE audit.
What it changes
After #4660, each candidate's first check, the generator's congruence (
residue), dominates g = 2. It reduced p bit-serially modulo 24 or 10: about 10 instructions per bit of p, around 5,000 at 512 bits, on every candidate.Now:
mulhduwith the reciprocal⌈2⁶⁵/3⌉or⌈2⁶⁶/5⌉, which is exact for every 64-bit value.That is about 4 instructions per digit plus 20.
goodResand the proofs that use it are unchanged.Search's
smallMod,trialandsievehave no other user, so they and their proofs (Proof/MillerRabin/PPC64LE/Search/{SmallMod,Sieve}.lean) are deleted.bad_postmoves toResidue.lean.Proof (
Proof/Ffdh/PPC64LE/ParameterCandidate/Residue.lean)val32_mod: a number is congruent to its digit sum modulo any d with 2³² mod d = 1.digitSum_ok: the loop.mod3_bvandmod5_bv, withquot3andquot5byomega: the reciprocal remainder.flag2andflag5, bydecideover the bounded residues: the flags.residue2_ok,residue5_okandresidue_ok.The constant-time proof of
residueis unchanged: every branch is still on the public generator.No TCB or spec change. No Rust change.
Checks
lake build: everything.Emit.lean: in full, onlyvg_ffdh_parameter_candidate_sievedchanges.check_lean_public_imports.pyon the edited modules.Static checkssteps.After rebasing onto
main(which changed the PPC64LE encoder), the function's generated.rswas regenerated in its own commit.Benchmark
Benchmarks run 42513095210: powerpc64,
modules=ffdh,groups=ffdh_parameters_g(2|5), base 5fd5181 = #4660's head. Medians:ffdh_parameters_g2/64ffdh_parameters_g5/64mainbefore #4660 took 1.09 s and 6.43 s; the audit's OpenSSL times were 80 ms and 70 ms.🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHGTYqNsecxgCdT9ZaD