-
Notifications
You must be signed in to change notification settings - Fork 18k
x/crypto/argon2: docs on thread parameter might make users inadvertently create non-portable hashes #42605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah, the docs could be better, happy to take a CL. We could go as far as saying "This is commonly left at 1." |
Cool, I can see what I can come up with in the next few days and will submit a CL over at the other repo. |
There's nothing wrong with using Example of encoded hash:
So consider adding a new function which returns encoded hash and Reference |
@simnalamburt that's #16971, and you're right it will probably help with this confusion, too. |
Change https://go.dev/cl/429775 mentions this issue: |
Both
IDKey
andKey
fromgolang.org/x/crypto/argon2
take athreads
parameter which is documented as following:While it's obviously wrong in hindsight, this sentence lead me to pass the (dynamic) value of
runtime.NumCPU()
as the value forthreads
when hashing passwords, which means the hashes Argon2 would create are different (i.e. stop matching) on hosts with different numbers of CPUs.Would it make sense to extend the comments here to point out that
threads
is not purely performance related, but also has an effect on the hash output (e.g. by stating it needs to be a fixed value and you can use the number of CPUs as a guideline)?The text was updated successfully, but these errors were encountered: