0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/test/parallel/test-crypto-randomfillsync-regression.js
James M Snell 4cbcfaee9c crypto: fix regression on randomFillSync
Signed-off-by: James M Snell <jasnell@gmail.com>

Fixes: https://github.com/nodejs/node/issues/35722
PR-URL: https://github.com/nodejs/node/pull/35723
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
2020-10-21 15:10:36 +05:30

19 lines
393 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const { randomFillSync } = require('crypto');
const { notStrictEqual } = require('assert');
const ab = new ArrayBuffer(20);
const buf = Buffer.from(ab, 10);
const before = buf.toString('hex');
randomFillSync(buf);
const after = buf.toString('hex');
notStrictEqual(before, after);