Add DivRemLimb and RemLimb traits#496
Conversation
d98ec04 to
efa774c
Compare
|
Making a draft temporarily, need to add comments about the unwraps. Also probably a good idea for it to be a draft until we figure out what the API should be. |
Since we have Bernstein-Yang now defined on both I can add a trait for computing GCD and bound If you do want to include it for completeness, it'd be good to check if it's actually faster than the constant-time implementation (Bernstein-Yang is surprisingly fast), and then I'd prefer it be exposed as a provided |
efa774c to
1b7026e
Compare
But that's constant-time, correct? I'm using it in a vartime context, so running the constant time thing would lead to performance degradatation. Let me run some benchmarks. |
1b7026e to
acbc887
Compare
|
Actually let me roll it back. There are a few assorted considerations:
|
acbc887 to
709a16d
Compare
@fjarri just stumbled on https://www.shiftleft.org/papers/byj/byj.pdf. |
This is the next step for entropyxyz/crypto-primes#36
Monty::Params(goes in line with the bounds onMontyandInteger);From<Limb>bound forInteger;num-bigintinstead ofnum-bigint-digfor compatibility withnum-modular(used in tests);DivRemLimbandRemLimbtraits (and separaterem_limb()methods - there's a significant speedup, and these are the ones I actually use incrypto-primes)