Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80538 views
1
2
var tape = require('tape')
3
var crypto = require('pbkdf2/browser')
4
5
var vectors = require('hash-test-vectors/pbkdf2')
6
7
tape('pbkdf2', function (t) {
8
vectors.forEach(function (input) {
9
//skip inputs that will take way too long
10
if(input.iterations > 10000) return
11
12
var key = crypto.pbkdf2Sync(input.password, input.salt, input.iterations, input.length)
13
14
if(key.toString('hex') !== input.sha1)
15
console.log(input)
16
17
t.equal(key.toString('hex'), input.sha1)
18
19
20
})
21
22
t.end()
23
})
24
25