GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: Adding best practises for crypto.pbkdf2 · nodejs/node@d16def5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • crypto.markdown
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/crypto.markdown‎

Copy file name to clipboardExpand all lines: doc/api/crypto.markdown
+9-1Lines changed: 9 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,16 @@ Asynchronous PBKDF2 function. Applies the selected HMAC digest function
620620
salt and number of iterations. The callback gets two arguments:
621621
`(err, derivedKey)`.
622622

623+
The number of iterations passed to pbkdf2 should be as high as possible, the
624+
higher the number, the more secure it will be, but will take a longer amount of
625+
time to complete.
626+
627+
Chosen salts should also be unique. It is recommended that the salts are random
628+
and their length is greater than 16 bytes. See [NIST SP 800-132] for details.
629+
623630
Example:
624631

625-
crypto.pbkdf2('secret', 'salt', 4096, 64, 'sha256', function(err, key) {
632+
crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', function(err, key) {
626633
if (err)
627634
throw err;
628635
console.log(key.toString('hex')); // 'c5e478d...1469e50'
@@ -789,6 +796,7 @@ See the reference for other recommendations and details.
789796
[RFC 3526]: http://www.rfc-editor.org/rfc/rfc3526.txt
790797
[crypto.pbkdf2]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
791798
[EVP_BytesToKey]: https://www.openssl.org/docs/crypto/EVP_BytesToKey.html
799+
[NIST SP 800-132]: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf
792800
[NIST SP 800-131A]: http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf
793801
[initialization vector]: http://en.wikipedia.org/wiki/Initialization_vector
794802
[Caveats]: #crypto_caveats

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.