1 |
3a515b92
|
cagy
|
var tape = require('tape')
|
2 |
|
|
var crypto = require('pbkdf2/browser')
|
3 |
|
|
|
4 |
|
|
var vectors = require('hash-test-vectors/pbkdf2')
|
5 |
|
|
|
6 |
|
|
tape('pbkdf2', function (t) {
|
7 |
|
|
vectors.forEach(function (input) {
|
8 |
|
|
// skip inputs that will take way too long
|
9 |
|
|
if (input.iterations > 10000) return
|
10 |
|
|
|
11 |
|
|
var key = crypto.pbkdf2Sync(input.password, input.salt, input.iterations, input.length)
|
12 |
|
|
|
13 |
|
|
if (key.toString('hex') !== input.sha1) {
|
14 |
|
|
console.log(input)
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
t.equal(key.toString('hex'), input.sha1)
|
18 |
|
|
})
|
19 |
|
|
|
20 |
|
|
t.end()
|
21 |
|
|
})
|