Conversation
|
It gets back the sig-verify speed lost in #1084 😄 . |
|
@davecgh Any chance we can get this into 0.13.0? |
|
@jcvernaleo (as per #1530)
|
onyb
left a comment
There was a problem hiding this comment.
@bmperrea Great work on this one! 👏
While the implementation is correct, I would like to suggest some updates to the code comments:
-
The Haskell function
secp256k1FieldInverseSquaredExponentis actually calculating the inverse directly, and not the squared inverse. This is because of the additionalandThen add x1added by you at the end.I think we should copy the algorithm verbatim, and our code should closely follow the same, to help future readers.
-
Following the above point, we should explain the addition chain for
prime - 3, as opposed toprime - 2, and only present the final multiplication as an extra step to compute the inverse. -
Finally, the explanation from "It follows the analogy..." until the end of the sentence could be framed in a better way to make it more understandable.
Here's a diff containing all the changes I proposed. Let me know if they make sense to you.
This uses the addition chain from Brian Smith's website to speed up
the inversion algorithm for btcec/field.go.