diff options
Diffstat (limited to 'openpgp/src/crypto')
-rw-r--r-- | openpgp/src/crypto/mod.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs index 51db3b18..7955d810 100644 --- a/openpgp/src/crypto/mod.rs +++ b/openpgp/src/crypto/mod.rs @@ -169,7 +169,7 @@ impl Password { /// /// This is useful when verifying detached signatures. pub fn hash_file<R: Read>(reader: R, algos: &[HashAlgorithm]) - -> Result<Vec<(HashAlgorithm, hash::Context)>> + -> Result<Vec<hash::Context>> { use std::mem; @@ -188,10 +188,10 @@ pub fn hash_file<R: Read>(reader: R, algos: &[HashAlgorithm]) // Hash all of the data. reader.drop_eof()?; - let mut hashes = + let hashes = mem::replace(&mut reader.cookie_mut().sig_group_mut().hashes, Default::default()); - let hashes = hashes.drain(..).collect(); + let hashes = hashes.into_iter().map(|(_, ctx)| ctx).collect(); Ok(hashes) } @@ -210,7 +210,8 @@ fn hash_file_test() { &expected.keys().cloned().collect::<Vec<HashAlgorithm>>()) .unwrap(); - for (algo, mut hash) in result.into_iter() { + for mut hash in result.into_iter() { + let algo = hash.algo(); let mut digest = vec![0u8; hash.digest_size()]; hash.digest(&mut digest); |