impl Hash for Signature

This commit is contained in:
keorn 2016-08-26 10:40:00 +02:00
parent 8bd0034ced
commit 2cc2bd6518
1 changed files with 7 additions and 0 deletions

View File

@ -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};
@ -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)