summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/s2k.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-05-20 12:48:42 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-05-20 13:39:41 +0200
commitd7c1901c28d6e51390f7e50c85da68ecfca31642 (patch)
tree7f26119172e20a1847b66a2528aff40535d31ed9 /openpgp/src/crypto/s2k.rs
parent37008e9c8b925ce541412d3a57c25d310af88bb9 (diff)
openpgp: Document the choice of default hash algorithm.
Diffstat (limited to 'openpgp/src/crypto/s2k.rs')
-rw-r--r--openpgp/src/crypto/s2k.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs
index 7c10781e..7f192381 100644
--- a/openpgp/src/crypto/s2k.rs
+++ b/openpgp/src/crypto/s2k.rs
@@ -60,6 +60,11 @@ impl Default for S2K {
let mut salt = [0u8; 8];
Yarrow::default().random(&mut salt);
S2K::Iterated {
+ // SHA2-256, being optimized for implementations on
+ // architectures with a word size of 32 bit, has a more
+ // consistent runtime across different architectures than
+ // SHA2-512. Furthermore, the digest size is large enough
+ // for every cipher algorithm currently in use.
hash: HashAlgorithm::SHA256,
salt: salt,
iterations: 26214400, // XXX: Calibrate somehow.