Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
hash-test-vectors
Advanced tools
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.
I took the original test vectors at http://www.nsrl.nist.gov/testdata/
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()
})
})
hmac vectors taken from rfc4231 (included in this repo)
each test vector has {key: hex, data: hex}
and the outputs of hmac with every
hash algorithm in node, also in hex encoding.
var vectors = require('hash-test-vectors')
var tape = require('tape')
var MySha1Hmac = require('./my-sha1-hmac-implementation')
vectors.forEach(function (v, i) {
tape('my-sha1-hmac against test vector ' + i, function (t) {
//test in bash64 encoding + as a buffer
t.equal(new MySha1Hmac(new Buffer(v.key, 'hex')).update(v.data, 'hex').digest('hex'), v.sha1)
t.end()
})
})
pbkdf2 vectors taken from rfc6070 (also included in this repo)
var vectors = require('hash-test-vectors')
var tape = require('tape')
var MyPbkdf2 = require('./my-pbkdf2-implementation')
vectors.forEach(function (v, i) {
tape('my-pbkdf2 against test vector ' + i, function (t) {
//test in bash64 encoding + as a buffer
var key = new MyPbkdf2(v.password, v.salt, v.iterations, v.length)
t.equal(key.toString('hex')), v.sha1)
t.end()
})
})
MIT
FAQs
test vectors for hashes
The npm package hash-test-vectors receives a total of 3,091 weekly downloads. As such, hash-test-vectors popularity was classified as popular.
We found that hash-test-vectors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.