diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/create-hmac/test.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/create-hmac/test.js')
-rw-r--r-- | node_modules/create-hmac/test.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/node_modules/create-hmac/test.js b/node_modules/create-hmac/test.js deleted file mode 100644 index cb0cd5765..000000000 --- a/node_modules/create-hmac/test.js +++ /dev/null @@ -1,41 +0,0 @@ -var test = require('tape') - -var algorithms = ['sha1', 'sha224','sha256', 'sha384', 'sha512', 'SHA512', 'md5', 'rmd160'] -var formats = [undefined, 'base64', 'hex', 'binary'] - -var vectors = require('hash-test-vectors/hmac') -var createHmac = require('./browser') -algorithms.forEach(function (alg) { - vectors.forEach(function (input) { - var key = new Buffer(input.key, 'hex') - var inputBuffer = new Buffer(input.data, 'hex') - - formats.forEach(function (format) { - test('hmac(' + alg + ') w/ ' + input.data.slice(0, 6) + '... as ' + format, function (t) { - var hmac = createHmac(alg, key) - - var formattedInput = format ? inputBuffer.toString(format) : inputBuffer - hmac.update(formattedInput, format) - - var formattedOutput = hmac.digest(format) - var output = new Buffer(formattedOutput, format) - - var truncated = input.truncate ? output.slice(0, input.truncate) : output - t.equal(truncated.toString('hex'), input[alg.toLowerCase()]) - t.end() - }) - }) - }) - - vectors.forEach(function (input) { - test('hmac(' + alg + ') as stream w/ ' + input.data.slice(0, 6) + '...', function (t) { - var hmac = createHmac(alg, new Buffer(input.key, 'hex')) - hmac.end(input.data, 'hex') - - var output = hmac.read() - var truncated = input.truncate ? output.slice(0, input.truncate) : output - t.equal(truncated.toString('hex'), input[alg.toLowerCase()]) - t.end() - }) - }) -}) |