summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/mod.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-01-03 15:03:45 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-01-03 15:03:45 +0100
commitb298e538d1bec7db5b2fad5d020df8dcf4c2067b (patch)
tree111004ba8aa9ea8ad0e1d369e5c408d9f89853b5 /openpgp/src/crypto/mod.rs
parent271802a7f1daf3802ecf5e496e1ede48da874031 (diff)
openpgp: Rename hash_file to hash_reader, improve documentation.
Diffstat (limited to 'openpgp/src/crypto/mod.rs')
-rw-r--r--openpgp/src/crypto/mod.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs
index e72ae672..9b338f13 100644
--- a/openpgp/src/crypto/mod.rs
+++ b/openpgp/src/crypto/mod.rs
@@ -165,10 +165,13 @@ impl Password {
}
-/// Hash the specified file.
+/// Hashes the given reader.
///
-/// This is useful when verifying detached signatures.
-pub fn hash_file<R: Read>(reader: R, algos: &[HashAlgorithm])
+/// This can be used to verify detached signatures. For a more
+/// convenient method, see [`DetachedVerifier`].
+///
+/// [`DetachedVerifier`]: ../parse/stream/struct.DetachedVerifier.html
+pub fn hash_reader<R: Read>(reader: R, algos: &[HashAlgorithm])
-> Result<Vec<hash::Context>>
{
use std::mem;
@@ -196,7 +199,7 @@ pub fn hash_file<R: Read>(reader: R, algos: &[HashAlgorithm])
#[test]
-fn hash_file_test() {
+fn hash_reader_test() {
use std::collections::HashMap;
let expected: HashMap<HashAlgorithm, &str> = [
@@ -205,8 +208,8 @@ fn hash_file_test() {
].iter().cloned().collect();
let result =
- hash_file(::std::io::Cursor::new(crate::tests::manifesto()),
- &expected.keys().cloned().collect::<Vec<HashAlgorithm>>())
+ hash_reader(std::io::Cursor::new(crate::tests::manifesto()),
+ &expected.keys().cloned().collect::<Vec<HashAlgorithm>>())
.unwrap();
for mut hash in result.into_iter() {