![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/randomfill/ |
var test = require('tape') var crypto = require('./browser') var Buffer = require('safe-buffer').Buffer test('sync', function (t) { t.test('first', function (t) { const buf = Buffer.alloc(10) const before = buf.toString('hex') crypto.randomFillSync(buf, 5, 5) const after = buf.toString('hex') t.notEqual(before, after) t.equal(before.slice(0, 10), after.slice(0, 10)) t.end() }) }) test('async', function (t) { t.test('first', function (t) { const buf = Buffer.alloc(10) const before = buf.toString('hex') crypto.randomFill(buf, 5, 5, function (err, bufa) { t.error(err) const after = bufa.toString('hex') t.notEqual(before, after) t.equal(before.slice(0, 10), after.slice(0, 10)) t.ok(buf === bufa, 'same buffer') t.end() }) }) })