Package Exports
- hash-test-vectors
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hash-test-vectors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hash-test-vectors
The nist test vectors expanded to cover every hash function supported by node.js, output is saved in a json file, so that it is possible to run tests in the browser.
NIST provides test vectors for sha and md5, and this module takes that set and outputs a json file containing the input (in base 64) plus all output of every hash function that node.js supports.
This makes it easy to test javascript hash functions, with fairly roboust coverage.
example
var vectors = require('hash-test-vectors')
var tape = require('tape')
var MySha1 = require('./my-sha1-implementation')
vectors.forEach(function (v, i) {
tape('my-sha1 against test vector ' + i, function (t) {
//test in bash64 encoding + as a buffer
t.equal(new MySha1().update(v.input, 'base64').digest('hex'), v.sha1)
t.equal(new MySha1().update(new Buffer(v.input, 'base64')).digest('hex'), v.sha1)
t.end()
})
})
License
MIT