mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
crypto: refactor randomBytes()
Use the scrypt() infrastructure to reimplement randomBytes() and randomFill() in a simpler manner. PR-URL: https://github.com/nodejs/node/pull/20816 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
c188cc5338
commit
078bb0f0a0
4 changed files with 66 additions and 212 deletions
|
@ -120,7 +120,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
|||
crypto.pbkdf2('password', 'salt', 1, 20, 'sha256', mc);
|
||||
|
||||
crypto.randomBytes(1, common.mustCall(function rb() {
|
||||
testInitialized(this, 'RandomBytes');
|
||||
testInitialized(this, 'AsyncWrap');
|
||||
}));
|
||||
|
||||
if (typeof process.binding('crypto').scrypt === 'function') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue