entropyxyz / crypto-primes

Random prime generation and primality testing library based on `crypto-bigint`.
https://docs.rs/crypto-primes
Apache License 2.0
17 stars 4 forks source link

`BoxedUint` support #40

Closed fjarri closed 7 months ago

fjarri commented 7 months ago

This may supersede #39. It uses *_like constructors (see https://github.com/RustCrypto/crypto-bigint/pull/533) instead of automatic widening, which I think is a safer approach.

The 1024 bit safe prime generation is about 30% slower for BoxedUint compared to Uint. Not too bad for a start, but clearly there is room for improvement.

@xuganyu96 sorry, tried to base it on your PR, but I guess I changed the first commit too much, and it's not assigned to you anymore.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (752bdee) 99.20% compared to head (2b44a1f) 99.23%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #40 +/- ## ========================================== + Coverage 99.20% 99.23% +0.02% ========================================== Files 9 9 Lines 1386 1433 +47 ========================================== + Hits 1375 1422 +47 Misses 11 11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

fjarri commented 7 months ago

@tarcieri I think this concludes the initial support stage for BoxedUint. If you release another pre version of crypto-bigint, I'll publish a pre version of this crate so that you could try it out in rsa.

tarcieri commented 7 months ago

@fjarri https://github.com/RustCrypto/crypto-bigint/pull/535

fjarri commented 7 months ago

Published v0.6.0-pre.0.

Before 0.6.0 proper I may tweak the public API a little with respect to how bits_precision is passed.

Also filed #41 to investigate the BoxedUint performance.