diff options
Diffstat (limited to 'openpgp/src/crypto/mpi.rs')
-rw-r--r-- | openpgp/src/crypto/mpi.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs index 8f9cfb2a..9eac133b 100644 --- a/openpgp/src/crypto/mpi.rs +++ b/openpgp/src/crypto/mpi.rs @@ -17,6 +17,7 @@ use std::fmt; use std::cmp::Ordering; +use std::io::Write; #[cfg(test)] use quickcheck::{Arbitrary, Gen}; @@ -237,7 +238,7 @@ impl fmt::Debug for MPI { } impl Hash for MPI { - fn hash(&self, hash: &mut hash::Context) { + fn hash(&self, hash: &mut dyn hash::Digest) { let len = self.bits() as u16; hash.update(&len.to_be_bytes()); @@ -545,8 +546,9 @@ impl PublicKey { } impl Hash for PublicKey { - fn hash(&self, hash: &mut hash::Context) { - self.serialize(hash).expect("hashing does not fail") + fn hash(&self, mut hash: &mut dyn hash::Digest) { + self.serialize(&mut hash as &mut dyn Write) + .expect("hashing does not fail") } } @@ -806,8 +808,9 @@ impl SecretKeyMaterial { } impl Hash for SecretKeyMaterial { - fn hash(&self, hash: &mut hash::Context) { - self.serialize(hash).expect("hashing does not fail") + fn hash(&self, mut hash: &mut dyn hash::Digest) { + self.serialize(&mut hash as &mut dyn Write) + .expect("hashing does not fail") } } @@ -930,8 +933,9 @@ impl Ciphertext { } impl Hash for Ciphertext { - fn hash(&self, hash: &mut hash::Context) { - self.serialize(hash).expect("hashing does not fail") + fn hash(&self, mut hash: &mut dyn hash::Digest) { + self.serialize(&mut hash as &mut dyn Write) + .expect("hashing does not fail") } } @@ -1021,8 +1025,9 @@ pub enum Signature { } impl Hash for Signature { - fn hash(&self, hash: &mut hash::Context) { - self.serialize(hash).expect("hashing does not fail") + fn hash(&self, mut hash: &mut dyn hash::Digest) { + self.serialize(&mut hash as &mut dyn Write) + .expect("hashing does not fail") } } |