pbkdf2
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
create-hash | 1.2.0 | 2.39 kB | MIT | prod | |
create-hmac | 1.1.7 | 2.37 kB | MIT | prod | |
ripemd160 | 2.0.2 | 3.69 kB | MIT | prod | |
safe-buffer | 5.2.1 | 9.74 kB | MIT | prod | |
sha.js | 2.4.11 | 9.74 kB | (MIT AND BSD-3-Clause) | prod |
PBKDF2 is a JavaScript library that provides the functionality of Password-Based Key Derivation Function 2 (PBKDF2). This technique provides cryptographic security by creating derived keys from a given password and salt. Interestingly, PBKDF2 supports any hashing algorithm returned from crypto.getHashes()
. This versatility enhances its application in diverse cryptographic operations requiring supported hashing algorithms.
You can conveniently use PBKDF2 in your JavaScript projects by first installing the module from the npm registry using the command npm install pbkdf2
. After installation, you will require the library in your project file. For example:
var pbkdf2 = require('pbkdf2')
Then, call the pbkdf2Sync
function, providing necessary arguments including the password, salt, number of iterations, key length, and digest.
var derivedKey = pbkdf2.pbkdf2Sync('password', 'salt', 1, 32, 'sha512')
For optimal performance, consider using the asynchronous variant (pbkdf2.pbkdf2
), especially when browserified, as it enables the utilization of window.crypto.subtle
.
For a comprehensive understanding of the PBKDF2 library, refer to the Node.js documentation specific to this package, which is readily available at the following URL: https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback. This resource provides a detailed, structured, and up-to-date information guide on how to adopt and effectively use the PBKDF2 library in your JavaScript projects.