Move PublicKey to store uncompressed bytes.

This is an optimisation that allows for faster hashing of a public key,
however it adds a penalty to SSZ encoding because we need to go
decompressed -> PublicKey -> compressed.

The spec presently uses compressed bytes to store public keys, however
I'm hoping it will change.
This commit is contained in:
Paul Hauner
2019-03-13 14:41:43 +11:00
parent 243ef2db80
commit bfa2e71b46
3 changed files with 44 additions and 18 deletions

View File

@@ -33,7 +33,7 @@ impl Signature {
/// Verify the Signature against a PublicKey.
pub fn verify(&self, msg: &[u8], domain: u64, pk: &PublicKey) -> bool {
self.0.verify(msg, domain, pk.as_raw())
self.0.verify(msg, domain, &pk.as_raw())
}
/// Verify the Signature against a PublicKey, where the message has already been hashed.
@@ -44,7 +44,7 @@ impl Signature {
pk: &PublicKey,
) -> bool {
self.0
.verify_hashed(x_real_hashed, x_imaginary_hashed, pk.as_raw())
.verify_hashed(x_real_hashed, x_imaginary_hashed, &pk.as_raw())
}
/// Returns the underlying signature.