RustCrypto / crypto-bigint

Cryptography-oriented big integer library with constant-time, stack-allocated (no_std-friendly) implementations of modern formulas
Apache License 2.0
167 stars 45 forks source link

Inverse `Even` modulus #591

Closed pinkforest closed 2 months ago

pinkforest commented 2 months ago

RSA has Even inverse modulus because p-1 for Euler's totient

But only Odd is provided via BoxedUint::inv_odd_mod - similar to BY-GCD

I see @fjarri asked similar stuff before in math stackexchange:

fjarri commented 2 months ago

I needed it for the same thing (inversion modulo totient), and the answer to that M.SE question is implemented in https://docs.rs/crypto-bigint/latest/crypto_bigint/struct.Uint.html#method.inv_mod . Not sure why it wasn't extended to BoxedUint, but it's probably quite straightforward.

tarcieri commented 2 months ago

Indeed that should be easy to port over

tarcieri commented 2 months ago

Fixed in #594