@@ -620,9 +620,16 @@ Asynchronous PBKDF2 function. Applies the selected HMAC digest function |
620 | 620 | salt and number of iterations. The callback gets two arguments: |
621 | 621 | `(err, derivedKey)`. |
622 | 622 |
|
| 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 | + |
623 | 630 | Example: |
624 | 631 |
|
625 | | - crypto.pbkdf2('secret', 'salt', 4096, 64, 'sha256', function(err, key) { |
| 632 | + crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', function(err, key) { |
626 | 633 | if (err) |
627 | 634 | throw err; |
628 | 635 | console.log(key.toString('hex')); // 'c5e478d...1469e50' |
@@ -789,6 +796,7 @@ See the reference for other recommendations and details. |
789 | 796 | [RFC 3526]: http://www.rfc-editor.org/rfc/rfc3526.txt |
790 | 797 | [crypto.pbkdf2]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback |
791 | 798 | [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 |
792 | 800 | [NIST SP 800-131A]: http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf |
793 | 801 | [initialization vector]: http://en.wikipedia.org/wiki/Initialization_vector |
794 | 802 | [Caveats]: #crypto_caveats |
|