Server IP : 162.213.251.212 / Your IP : 3.144.34.97 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/allssztx/public_html/easybuyer/node_modules/randomfill/ |
Upload File : |
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() }) }) })