Skip to content

Commit

Permalink
impl Hash for Signature
Browse files Browse the repository at this point in the history
  • Loading branch information
keorn committed Aug 26, 2016
1 parent 8bd0034 commit 2cc2bd6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ethkey/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::ops::{Deref, DerefMut};
use std::cmp::PartialEq;
use std::{mem, fmt};
use std::str::FromStr;
use std::hash::{Hash, Hasher};
use secp256k1::{Message as SecpMessage, RecoverableSignature, RecoveryId, Error as SecpError};
use secp256k1::key::{SecretKey, PublicKey};
use rustc_serialize::hex::{ToHex, FromHex};
Expand Down Expand Up @@ -114,6 +115,12 @@ impl Default for Signature {
}
}

impl Hash for Signature {
fn hash<H: Hasher>(&self, state: &mut H) {
H520::from(self.0).hash(state);
}
}

impl From<[u8; 65]> for Signature {
fn from(s: [u8; 65]) -> Self {
Signature(s)
Expand Down

0 comments on commit 2cc2bd6

Please sign in to comment.