Uname: 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
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 3.15.141.23
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : test.js
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()
    })
  })
})
© 2025 GrazzMean-Shell