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

k256: Taproot Schnorr (BIP 340) #554

Merged
merged 7 commits into from
May 21, 2022
Merged

Conversation

nickray
Copy link
Member

@nickray nickray commented May 19, 2022

Implements Taproot-flavored Schnorr signatures as described in:
https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki

Based on #482, rebased onto master branch.

@nickray nickray requested a review from tarcieri May 19, 2022 09:03
@nickray nickray marked this pull request as ready for review May 19, 2022 11:07
Comment on lines 30 to 35
// TODO(nickray): maybe store (FieldElement, NonScalar), avoiding the unwraps.
// However, this
// a) contradicts tarcieri's philosophy of storing "bag of bytes"
// b) makes the Debug, Eq, PartialEq, PartialOrd, Ord impls tricky,
// as FieldElement + NonZeroScalar don't implement them, so we'd have to
// either modify upstream or implement in terms of the calculated `to_bytes`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to store the parsed components of the signature alongside bytes.

To simplify some of the questions you can remove the PartialOrd and Ord derives. I'm not sure they're useful for anything.

A handwritten Debug would probably make sense, either displaying the byte serialization or the parsed components of the signature.

k256/src/schnorr.rs Outdated Show resolved Hide resolved
@tarcieri
Copy link
Member

Will go ahead and merge this.

There are a few things I think can be addressed in a followup PR, most notably implementing the signature crate's traits. I'll try to take a look at that in the next few days.

@tarcieri tarcieri merged commit 0a06245 into RustCrypto:master May 21, 2022
@nickray nickray deleted the taproot branch May 22, 2022 00:42
nickray added a commit to nickray/elliptic-curves that referenced this pull request May 23, 2022
Implements Taproot-flavored Schnorr signatures as described in:

https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki

Co-authored-by: Tony Arcieri <bascule@gmail.com>
Co-authored-by: Nicolas Stalder <nstalder@jumpcrypto.com>
This was referenced May 24, 2022
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

Successfully merging this pull request may close these issues.

2 participants