-
Notifications
You must be signed in to change notification settings - Fork 196
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
make exptmod algorithms private? #433
Comments
I just wanted to say "I think there are even more currently public functions which could be private" but after having a look it seems like there's only the reduce stuff left
maybe also those
|
your opinion? @czurnieden @nijtmans @karel-m |
Well Tcl doens't use any of those, so no objection from me ;-) |
Some of those reduction functions are useful externally I think. But I have to look more into it. My problem is that I don't have that much knowledge of the theory behind those functions and the API somehow exposes technical details. I think in particular those _2k and 2k_l functions look redundant or could maybe hidden behind a common API. Then there is the issue that some of the reduce functions mutate their input. They should instead take another argument. But I think someone with more background knowledge could judge better. Ping @czurnieden |
Yes, if the input can be calculated, that is not dependent on user input, that function can go private. If we do it we should deprecate them formally, some people might use them directly, for some reason or another. For the primetests:
|
The |
As I haven't found anything regarding the rest of the |
@czurnieden would you like to/have time to prepare two PRs regarding this issue for discussion? Maybe one for primes and one for reduce. I think we should address this before the next releases but there is no hurry here. |
Feared that ;-) It's a bit of work, so let me outline first for the early complains. Primetests:
Reducing:
So far, so good? |
You don't have to do it ;) I would also work on it if the time of release approaches, but right now I am very busy with other unrelated stuff. But then - I am also no expert in those things. Let's first discuss the primetest, or start with that. I think we might even want to keep mp_prime_fermat because it is so simple, e.g., if you want a slimmed down version. How can one use the other prime tests if they are made private, e.g., the strong lucas selfridge? I actually have no idea how things should look. typedef enum {
...
} mp_prime_test;
mp_err mp_is_prime(mp_prime_test, int trials, const mp_int*); Or maybe only expose mp_err mp_is_prime(int trials, const mp_int*); // just use "the best" prime test being around? Regarding deprecation - in develop we can just remove the stuff. And after that backport the deprecations to 1.x, see #418. |
@sjaeckel You know much more about the crypto stuff and how things are used there. Do you have an idea on what should be exposed and how the API should look like? |
The "reduce" part is simple, see #465 if I haven't missed anything. (To slow. Again ;-) )
The Miller-Rabin test is not much slower and not much more complex, but safer by a magnitude or two.
You don't.
Yes, exactly. The Miller-Rabin tests is an exception because you can build a safe probable-prime-test with it alone and have a smaller but also slower prime-test. The rest belongs together, hard to use them individually and if you try you'll end with something resembling our
Now, that is a method to my liking! ;-)
Ah, ok. |
Does it make sense to make the exptmod algorithms private, i.e., the mp_reduce* functions in 2.0? Are they useful by itself? Some of these functions look as if they are more of internal use, but I might be wrong. The same applies maybe to some of the prime functions. Could someone enlighten me? @czurnieden
The text was updated successfully, but these errors were encountered: