-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
doc: Fix pbkdf2 example #16203
doc: Fix pbkdf2 example #16203
Conversation
/cc @nodejs/crypto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits addressed
doc/api/crypto.md
Outdated
@@ -1616,7 +1616,7 @@ Example: | |||
|
|||
```js | |||
const crypto = require('crypto'); | |||
crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => { | |||
crypto.pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { | |||
if (err) throw err; | |||
console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to change this value as well (the first bytes should still be the same, but the last bytes will most likely be different).
doc/api/crypto.md
Outdated
@@ -1668,7 +1668,7 @@ Example: | |||
|
|||
```js | |||
const crypto = require('crypto'); | |||
const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); | |||
const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); | |||
console.log(key.toString('hex')); // '3745e48...aa39b34' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@tniessen I've updated the output. Shame on me for assuming it was outdated anyway. |
Landed in b5c74d8, thank you for your contribution! 🎉 |
PR-URL: nodejs/node#16203 Refs: nodejs/node#3415 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
512 bytes seems like a lot. See #3415