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.

18 lines
508 B

11 years ago
// Crypto extensions
//
// PBKDF2 with SHA512 - browser version
var sjcl = require('../sjcl');
11 years ago
var hmacSHA512 = function (key) {
var hasher = new sjcl.misc.hmac( key, sjcl.hash.sha512 );
this.encrypt = function () {
return hasher.encrypt.apply( hasher, arguments );
};
11 years ago
};
exports.pbkdf2Sync_sha512 = function(password, salt, iterations, keylen) {
var derivedKey = sjcl.misc.pbkdf2( password, salt, iterations, 512, hmacSHA512 );
return sjcl.codec.hex.fromBits( derivedKey )
11 years ago
};