Spamworldpro Mini Shell
Spamworldpro


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/crypto-browserify/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/vreg/node_modules/crypto-browserify/test/create-hmac.js
var test = require('tape')

var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160']
var vectors = require('hash-test-vectors/hmac')
testLib('createHmac in crypto-browserify', require('../').createHmac)
testLib('create-hmac/browser', require('create-hmac/browser'))

function testLib (name, createHmac) {
  algorithms.forEach(function (alg) {
    test(name + ' hmac(' + alg + ')', function (t) {
      run(0)
      function run (i) {
        if (i >= vectors.length) {
          return t.end()
        }
        var input = vectors[i]
        var output = createHmac(alg, new Buffer(input.key, 'hex'))
          .update(input.data, 'hex').digest()

        output = input.truncate ? output.slice(0, input.truncate) : output
        output = output.toString('hex')
        if (output !== input[alg]) {
          t.equal(output, input[alg])
        }
        setTimeout(run, 0, i + 1)
      }
    })

    test('hmac(' + alg + ')', function (t) {
      run(0)
      function run (i) {
        if (i >= vectors.length) {
          return t.end()
        }
        var input = vectors[i]
        var hmac = createHmac(alg, new Buffer(input.key, 'hex'))

        hmac.end(input.data, 'hex')
        var output = hmac.read()

        output = input.truncate ? output.slice(0, input.truncate) : output
        output = output.toString('hex')
        if (output !== input[alg]) {
          t.equal(output, input[alg])
        }
        setTimeout(run, 0, i + 1)
      }
    })
  })
}

Spamworldpro Mini