{"id":18458743,"url":"https://github.com/browserify/hash-test-vectors","last_synced_at":"2025-04-08T05:34:33.379Z","repository":{"id":16903423,"uuid":"19664366","full_name":"browserify/hash-test-vectors","owner":"browserify","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-21T09:59:33.000Z","size":274,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T06:51:09.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browserify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-11T11:11:22.000Z","updated_at":"2023-11-22T01:25:25.000Z","dependencies_parsed_at":"2022-07-16T10:46:14.447Z","dependency_job_id":null,"html_url":"https://github.com/browserify/hash-test-vectors","commit_stats":null,"previous_names":["crypto-browserify/hash-test-vectors"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-test-vectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-test-vectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-test-vectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-test-vectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserify","download_url":"https://codeload.github.com/browserify/hash-test-vectors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247785919,"owners_count":20995641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T08:19:53.511Z","updated_at":"2025-04-08T05:34:28.369Z","avatar_url":"https://github.com/browserify.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hash-test-vectors\n\nThe nist test vectors expanded to cover every hash function supported by node.js,\noutput is saved in a json file, so that it is possible to run tests in the browser.\n\nNIST provides test vectors for sha and md5, and this module takes\nthat set and outputs a json file containing the input (in base 64)\nplus all output of every hash function that node.js supports.\n\nThis makes it easy to test javascript hash functions, with fairly roboust coverage.\n\nI took the original test vectors at http://www.nsrl.nist.gov/testdata/\n\n## example\n\n``` js\nvar vectors = require('hash-test-vectors')\nvar tape = require('tape')\nvar MySha1 = require('./my-sha1-implementation')\n\nvectors.forEach(function (v, i) {\n\n  tape('my-sha1 against test vector ' + i, function (t) {\n    //test in bash64 encoding + as a buffer\n    t.equal(new MySha1().update(v.input, 'base64').digest('hex'), v.sha1)\n    t.equal(new MySha1().update(new Buffer(v.input, 'base64')).digest('hex'), v.sha1)\n    t.end()\n  })\n})\n\n```\n\n## hmac example\n\nhmac vectors taken from [rfc4231](http://tools.ietf.org/rfc/rfc4231.txt)\n(included in this repo)\n\neach test vector has `{key: hex, data: hex}` and the outputs of hmac with every\nhash algorithm in node, also in hex encoding.\n\n``` js\nvar vectors = require('hash-test-vectors')\nvar tape = require('tape')\nvar MySha1Hmac = require('./my-sha1-hmac-implementation')\n\nvectors.forEach(function (v, i) {\n  tape('my-sha1-hmac against test vector ' + i, function (t) {\n    //test in bash64 encoding + as a buffer\n    t.equal(new MySha1Hmac(new Buffer(v.key, 'hex')).update(v.data, 'hex').digest('hex'), v.sha1)\n    t.end()\n  })\n})\n\n```\n\n## pbkdf2 example\n\npbkdf2 vectors taken from [rfc6070](http://tools.ietf.org/rfc/rfc6070.txt)\n(also included in this repo)\n\n``` js\nvar vectors = require('hash-test-vectors')\nvar tape = require('tape')\nvar MyPbkdf2 = require('./my-pbkdf2-implementation')\n\nvectors.forEach(function (v, i) {\n  tape('my-pbkdf2 against test vector ' + i, function (t) {\n    //test in bash64 encoding + as a buffer\n    var key = new MyPbkdf2(v.password, v.salt, v.iterations, v.length)\n    t.equal(key.toString('hex')), v.sha1)\n    t.end()\n  })\n})\n\n```\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fhash-test-vectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserify%2Fhash-test-vectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fhash-test-vectors/lists"}