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

Add bip340 schnorr #237

Merged
merged 5 commits into from Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/constants.rs
Expand Up @@ -34,6 +34,15 @@ pub const MAX_SIGNATURE_SIZE: usize = 72;
/// The maximum size of a compact signature
pub const COMPACT_SIGNATURE_SIZE: usize = 64;

/// Size of a Schnorr signature
pub const SCHNORRSIG_SIGNATURE_SIZE: usize = 64;

/// Size of a Schnorr public key
pub const SCHNORRSIG_PUBLIC_KEY_SIZE: usize = 32;

/// Size of a key pair
pub const KEY_PAIR_SIZE: usize = 96;

/// The Prime for the secp256k1 field element.
pub const FIELD_SIZE: [u8; 32] = [
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -142,6 +142,7 @@ mod context;
pub mod constants;
pub mod ecdh;
pub mod key;
pub mod schnorrsig;
Copy link
Member

Choose a reason for hiding this comment

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

I'd like the module to be called bip340 rather than Schnorr. Both as a dig at Schnorr for patenting things, and also to be clear that this is a specific Schnorr-based signature scheme specified in BIP340.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Schnorr has been removed from this module :). Only mentions left are in the sys module as the method calls of secp use it.

#[cfg(feature = "recovery")]
pub mod recovery;

Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Expand Up @@ -67,7 +67,7 @@ macro_rules! serde_impl(

if d.is_human_readable() {
let sl: &str = ::serde::Deserialize::deserialize(d)?;
SecretKey::from_str(sl).map_err(D::Error::custom)
$t::from_str(sl).map_err(D::Error::custom)
} else {
let sl: &[u8] = ::serde::Deserialize::deserialize(d)?;
if sl.len() != $len {
Expand Down