-
Notifications
You must be signed in to change notification settings - Fork 295
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
secp256k1: Expose Jacobian point equivalency func. #3436
secp256k1: Expose Jacobian point equivalency func. #3436
Conversation
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.
LGTM. NBD, but should it be called EquivalentNonConst
?
22760ba
to
3e8b1b1
Compare
Good point. That would be less likely to potentially cause confusion of exact equality versus equivalent points. Updated. |
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.
ok with trivial suggestion
7dd885a
to
352daf3
Compare
352daf3
to
d0e846e
Compare
This splits the benchmarks related to curve operations into their own file to be more consistent with other benchmarks in the package.
This move the benchmarks related to public keys into their own file to be more consistent with other benchmarks in the package. It also removes the now empty bench_test.go file.
This splits the closure that determines if two Jacobian represent the same affine point by first converting them to affine points to a separate func for use in upcoming tests and benchmarks.
This exposes a new function on the JacobianPoint type named EquivalentNonConst which efficiently determines if two Jacobian points represent the same affine point without actually converting the points to affine. This provides a significant speedup versus first converting to affine for use cases that need the functionality. One example where it is useful is adaptor signatures. It includes comprehensive tests for edge conditions as well as ongoing randomized testing. The following benchmark shows a before and after comparison of checking Jacobian point equivalency with the new method versus the affine conversion approach: name old time/op new time/op delta -------------------------------------------------------------------------------- JacobianPointEquivalency 17.2µs ± 2% 0.5µs ± 1% -97.24% (p=0.000 n=10+10)
d0e846e
to
809d21b
Compare
This exposes a new function on the
JacobianPoint
type namedEquivalentNonConst
which efficiently determines if two Jacobian points represent the same affine point without actually converting the points to affine.This provides a significant speedup versus first converting to affine for use cases that need the functionality. One example where it is useful is adaptor signatures.
It includes comprehensive tests for edge conditions as well as ongoing randomized testing.
Finally, it also includes some preliminary commits to make the benchmark structure more consistent and introduce a new benchmark for testing Jacobian point equivalency.
The following benchmark shows a before and after comparison of checking Jacobian point equivalency with the new method versus the affine conversion approach: