You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pbkdf2.js 509B

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