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

Issue:
Argon2 uses wrong value for thread count
Seems like a copy paste error introduced in #213. Error is in line 102:
https://github.com/RustCrypto/password-hashes/blob/a09fa2316769d7444d30a0be0dbd9ee281f8fcd6/argon2/src/instance.rs#L96-L104

Surely the number of threads has nothing to do with `t_cost`, the number of passes?

It used to use the value of `context.threads`, which is just `parallelism` (aka `lanes`):
https://github.com/RustCrypto/password-hashes/blob/3bfc4d9a5fa281916f39cfc700736115af3ac950/argon2/src/instance.rs#L98-L106

@tarcieri


Discussion / hints:

Fix patch:
diff --git a/argon2/src/instance.rs b/argon2/src/instance.rs
index 58175588..f0d0943d 100644
--- a/argon2/src/instance.rs
+++ b/argon2/src/instance.rs
@@ -99,7 +99,7 @@ impl<'a> Instance<'a> {
             passes: context.params.t_cost(),
             lane_length,
             lanes: context.params.lanes(),
-            threads: context.params.t_cost(),
+            threads: context.params.p_cost(),
             alg,
         };
 


Test patch: