diff options
Diffstat (limited to 'openpgp/src/crypto/hash.rs')
-rw-r--r-- | openpgp/src/crypto/hash.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs index 410d9eae..27641429 100644 --- a/openpgp/src/crypto/hash.rs +++ b/openpgp/src/crypto/hash.rs @@ -31,7 +31,7 @@ use std::io::{self, Write}; const DUMP_HASHED_VALUES: Option<&str> = None; /// Hasher capable of calculating a digest for the input byte stream. -pub(crate) trait Digest: DynClone + Send + Sync { +pub(crate) trait Digest: DynClone + Write + Send + Sync { /// Returns the algorithm. fn algo(&self) -> HashAlgorithm; @@ -229,6 +229,16 @@ impl Digest for HashDumper { } } +impl io::Write for HashDumper { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + self.hasher.write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.hasher.flush() + } +} + /// Hashes OpenPGP packets and related types. /// /// Some OpenPGP data structures need to be hashed to be covered by |