-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class group optimization #35
base: master
Are you sure you want to change the base?
Conversation
…linear congruence solver
…s (at a minimum) for all ops -- includes floor division bugfix
…r class group elements
Agree on rsa groups; I'll take a look later this week. Comments look good and moving group operations into mod.rs should work. I like your idea of having the scratch space return tuples, i.e. if N = 5,
|
Ok, I addressed all comments brought up -- sorry this took some time, I ran into a good number of Rust-related issues before landing to Keep the feedback coming |
Instead of passing in individual integers into It would also be good to make a parallel FMpz type analogous to the Mpz type for flint operations, by making a wrapper struct with methods for the flint bindings that take on the burden of being "unsafe" themselves instead of having an unsafe block in the squaring operation. First glance looks great otherwise. |
…flint_mpz_struct to flinty_mpz for clarity
@mstraka100 we may be able to hack together a macro to have ranges in the |
Hi all, This seems to be a pretty exciting improvement! I checked out the corresponding branch and ran the benchmarks, but the class group accumulator Thanks! |
@pgrinaway I'll look into this some more, but as a sanity check, did you compile with the external dependencies ( Regarding this PR: No one is actively working on this repo at the moment, and I'm just fielding questions and issues as they arise. If people are interested in getting this merged, @alanefl or @mstraka100 would be the best developers to talk to. Ideally, someone would sign on as a regular maintainer, so please send me a DM if you (or anyone else) is interested in taking on that role! |
Thanks for the reply!
I realized I didn't, so that is likely the problem. However, I can't seem to get
Got it, thanks. We're evaluating the class group stuff now, so I will keep you posted. |
Actually, I think I've fixed the |
OK, I am seeing about the same speed (~400ms to add 10 elements) with this branch vs. master in the class group EDIT: I do see a 2x speedup on the exponentiation operation by including |
What is NUDULP? A typo for NUDUPL, or a different algorithm? |
// 2048-bit prime, negated, congruent to 3 mod 4. Generated using OpenSSL. | ||
// According to "A Survey of IQ Cryptography" (Buchmann & Hamdy) Table 1, IQ-MPQS for computing | ||
// discrete logarithms in class groups with a 2048-bit discriminant is comparable in complexity to | ||
// GNFS for factoring a 4096-bit integer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty old paper (2001), and it's the single source that everyone cites for estimates of class group security. Tell me why I shouldn't be skeptical!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. The recent interest in class groups seems to have accelerated performance of algorithms for computing exponents (https://www.chia.net/2019/07/18/chia-vdf-competition-round-2-results-and-announcements.en.html). I don't see why that wouldn't also be the case for attacks, even independent of new algorithmic developments. I would be skeptical myself.
This paper presents a case against significant algorithmic improvements over IQ-MPQS for discrete log, but it's from 1999 and I haven't scrutinized it: https://www.iacr.org/archive/asiacrypt2003/07_Session07/05_149/28940064.pdf
This PR is a WIP, but I thought I'd put it up for visibility since it's large. We still need to update the benches so that we get a clean comparison between different optimizations and between class groups and RSA groups. Will notify when that's ready.
This PR is big -- let's start having a discussion about it.
Here are the main changes/additions:
class.rs
file into a file that containsClassGroup
, a file that containsClassElem
, a file that defines the discriminant, and a file that defines and implementsClassCtx
Optimizations
ClassGroup
into aClassCtx
, a thread-local struct of Mpz variables that is only allocated once and then reused throughout all class group operations (bye bye clones). We implementedmpz.rs
as a rust wrapper around a handfulgmp-mpfr-sys
calls for better control over memory allocation (@mstraka100 can comment here). This also means we re-wrote the previous implementation using this interface. The classgroup modules look like this now:--features nudulp
or--features nudulp,flint
.Adding Flint as a Dependency
Getting the additional 2x speedup from optimization 2 requires a user to have
gmp
andmpfr
installed in their system (can be done with brew/apt). It also requires building and binding to the FLINT library. The decision in this PR was to include the entire source code for flint 2.5.2 under a newext/
directory (this PR omits the source code dump for clarity), and build it with cargo using thebuild.rs
file -- in fact, this is what gmp-mpfr-sys does for gmp. Feedback welcome.Summary of Benchmark Results for Group Ops