Skip to content
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

crypto pbkdf2 keylen: bits or bytes? #3415

Closed
santo74 opened this issue Oct 17, 2015 · 3 comments
Closed

crypto pbkdf2 keylen: bits or bytes? #3415

santo74 opened this issue Oct 17, 2015 · 3 comments
Labels
crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations.

Comments

@santo74
Copy link

santo74 commented Oct 17, 2015

The api docs use 512 for the keylen:

crypto.pbkdf2('secret', 'salt', 4096, 512, 'sha256', function(err, key) {
  if (err)
    throw err;
  console.log(key.toString('hex'));  // 'c5e478d...1469e50'
});

But they don't mention whether the keylen is in bits or bytes.
Given the fact that it has a value of 512 I would expect it to be in bits, but the end result seems to generate a key of 512 bytes

Some clarification would be welcome

@silverwind silverwind added crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations. labels Oct 17, 2015
@kenany
Copy link
Contributor

kenany commented Oct 17, 2015

This would be fixed by #3334 I think.

@santo74
Copy link
Author

santo74 commented Oct 18, 2015

Definitely. Apparently I missed that one during my search.

@brendanashworth
Copy link
Contributor

I think this can be closed then, as it was landed in ff8fa51.

lboecker pushed a commit to lboecker/node that referenced this issue Oct 14, 2017
512 bytes seems a lot. See nodejs#3415
tniessen pushed a commit that referenced this issue Oct 16, 2017
PR-URL: #16203
Refs: #3415
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
targos pushed a commit that referenced this issue Oct 18, 2017
PR-URL: #16203
Refs: #3415
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this issue Oct 18, 2017
PR-URL: nodejs/node#16203
Refs: nodejs/node#3415
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

No branches or pull requests

4 participants