Repository: RustCrypto/password-hashes (language: rust)

Issue:
argon2: Missing access to `Params::block_count()`
It's currently a bit difficult to use `Argon2::hash_password_into_with_memory` without knowing exactly how much memory is required. Can this function just be made public?


Discussion / hints:
Yes, it can be made public. Please submit a PR or otherwise I'll eventually get to it.

Fix patch:
diff --git a/argon2/src/params.rs b/argon2/src/params.rs
index 6b52932d..aae03d66 100644
--- a/argon2/src/params.rs
+++ b/argon2/src/params.rs
@@ -168,7 +168,7 @@ impl Params {
     }
 
     /// Get the number of blocks required given the configured `m_cost` and `p_cost`.
-    pub(crate) fn block_count(&self) -> usize {
+    pub fn block_count(&self) -> usize {
         (self.segment_length() * self.p_cost * SYNC_POINTS) as usize
     }
 }


Test patch: