Skip to content

crypto pbkdf2 keylen: bits or bytes? #3415

Description

@santo74

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

Activity

  1. added
    cryptoIssues and PRs related to the crypto subsystem.
    docIssues and PRs related to Node.js documentation.
    on Oct 17, 2015
  2. kenany commented on Oct 17, 2015

    @kenany
    Contributor

    This would be fixed by #3334 I think.

  3. santo74 commented on Oct 18, 2015

    @santo74
    Author

    Definitely. Apparently I missed that one during my search.

  4. brendanashworth commented on Oct 20, 2015

    @brendanashworth
    Contributor

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

  5. added a commit that references this issue on Oct 14, 2017
  6. added a commit that references this issue on Oct 16, 2017
  7. added a commit that references this issue on Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions