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

Derive Hash for ecdsa::Signature and SerializedSignature #433

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/ecdsa/mod.rs
Expand Up @@ -16,11 +16,11 @@ pub use self::recovery::{RecoveryId, RecoverableSignature};
use SECP256K1;

/// An ECDSA signature
#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct Signature(pub(crate) ffi::Signature);

/// A DER serialized Signature
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Hash)]
Copy link
Member

Choose a reason for hiding this comment

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

This will make it incompatible with the PartialEq, Eq traits, violating the required properties,
because data could somehow have arbitrary data after the len argument.

So I think we should implement Hash here manually

pub struct SerializedSignature {
data: [u8; 72],
len: usize,
Expand Down