Speedup sqrt
on PrimeField
when a square root exists.
#131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Applies daira's suggestion from #40 to make the square root algorithm skip computing the legendre symbol. This speeds up the square root when the element is actually a square root, in exchange for slowing down the square root when its not actually a square root.
I think this makes sense as a trade-off, as getting faster point decompression in the honest case is quite useful. And in cases I'm aware of, with an adversary who want to delay another node, you would have made your curve point pass deserialization and fail in other logic later on
cref #40
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the Github PR explorer