File: check-pbkdf2.js

package info (click to toggle)
node-hash-test-vectors 1.3.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,164 kB
  • sloc: makefile: 2; sh: 2
file content (17 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var vectors = require('./pbkdf2.json')
var crypto = require('crypto')
var assert = require('assert')

//since there is only sha1 pbkdf2 in node, I just copied the values from the RFC.
//just run it through node to double check that I got the values correct.


vectors.forEach(function (e, i) {
  console.log(i, e)
  assert.deepEqual(
    crypto.pbkdf2Sync(e.password, e.salt, e.iterations, e.length).toString('hex'),
    e.sha1
  )
})