Commits
Click on a commit to change the comparison rangefeat: add optimized modular exponentiation using Montgomery multiplication
Implements pow_mod_redc which uses Montgomery REDC algorithm for faster
modular exponentiation. This is significantly faster than the standard
pow_mod for large exponents.
The implementation:
- Uses existing mul_redc and square_redc functions
- Converts to/from Montgomery form once at start/end
- Handles edge cases (zero exponent, even modulus)
- Includes comprehensive tests and benchmarks
Expected performance improvement of 30-80% for cryptographic workloads. chore: apply nightly rustfmt