Rename canonical_hash to `hash

This commit is contained in:
Paul Hauner
2019-01-25 17:40:22 +11:00
parent 73d86bcc3b
commit f9acc42aca
11 changed files with 22 additions and 27 deletions

View File

@@ -18,7 +18,7 @@ pub use self::bls_aggregates::AggregatePublicKey;
pub const BLS_AGG_SIG_BYTE_SIZE: usize = 97;
use hashing::canonical_hash;
use hashing::hash;
use ssz::ssz_encode;
use std::default::Default;
@@ -30,13 +30,13 @@ fn extend_if_needed(hash: &mut Vec<u8>) {
/// For some signature and public key, ensure that the signature message was the public key and it
/// was signed by the secret key that corresponds to that public key.
pub fn verify_proof_of_possession(sig: &Signature, pubkey: &PublicKey) -> bool {
let mut hash = canonical_hash(&ssz_encode(pubkey));
let mut hash = hash(&ssz_encode(pubkey));
extend_if_needed(&mut hash);
sig.verify_hashed(&hash, &pubkey)
}
pub fn create_proof_of_possession(keypair: &Keypair) -> Signature {
let mut hash = canonical_hash(&ssz_encode(&keypair.pk));
let mut hash = hash(&ssz_encode(&keypair.pk));
extend_if_needed(&mut hash);
Signature::new_hashed(&hash, &keypair.sk)
}