Skip to content
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

Why does "epoint_set()" with point compression take longer time for secp224 than secp256? #53

Closed
k3coby opened this issue Oct 3, 2017 · 2 comments

Comments

@k3coby
Copy link

k3coby commented Oct 3, 2017

I’m trying to do a lot of point calculations on secp192, 224, 256, 384 and 521 using this library. However, when I tried to measure running times, I noticed that “epoint_set ()” with point compression enabled took much longer in secp224 than in secp256. It's weird because the implementation remained unchanged for different curves and other curves (160, 192, 384, 521) worked fine. Can anyone help me figure out why? Is it possible that there's some special optimizations for secp256 in this library? Thank you so much!

screen shot 2017-10-03 at 15 19 35

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Oct 3, 2017 via email

@k3coby
Copy link
Author

k3coby commented Oct 3, 2017

I see what you mean. When p is an odd prime and p = -1 mod 4, there's a direct way to calculate the square root modulo p, based on "quadratic reciprocity". However, if p = 1 mod 4, we have to use other algorithms to find that square root, which is much slower. It does make sense.

Thanks, Mike. I really appreciate your help!

Coby

@k3coby k3coby closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants