-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
doc: Fix 'pbkdf2Sync' encoding problem #1805
Conversation
/cc:@trevorah |
cc @nodejs/crypto |
😳 whoops, sorry I didnt notice that in my original PR. Good spot @Maledong! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated: 512 is an unusual key size (note that the key size parameter is in bytes, not bits). This might have originated from the misconception that it must match the output size of the hash function?
@tniessen I picked sha512 for this guide because its used in the crypto examples (https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) which this guide appears to mirror. |
@trevorah SHA512 is a good choice, just the output key size is unusual (512 bytes!). This works equally well: crypto.pbkdf2Sync('password', 'salt', 10000, 32, 'sha512') PBKDF2 is usually used to derive symmetric keys or to store passwords, neither of these applications requires keys with a size of 512 bytes. |
@tniessen hmm... weird. The only |
Uhh |
Ref: #1796. Since the '/newUser' request is encoded by 'sha512', and your corresponding '/auth' must also use 'sha512' as the digest encoding as well.
@trevorah:No problem. Just found that by accident when reading lines :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc format LGTM)
Thanks all! |
Ref: #1796.
Since the '/newUser' request is encoded by 'sha512', and your
corresponding '/auth' must also use 'sha512' as the digest encoding
as well. Otherwise your decoding isn't right.