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.
17 lines
508 B
17 lines
508 B
// Crypto extensions
|
|
//
|
|
// PBKDF2 with SHA512 - browser version
|
|
|
|
var sjcl = require('../sjcl');
|
|
|
|
var hmacSHA512 = function (key) {
|
|
var hasher = new sjcl.misc.hmac( key, sjcl.hash.sha512 );
|
|
this.encrypt = function () {
|
|
return hasher.encrypt.apply( hasher, arguments );
|
|
};
|
|
};
|
|
|
|
exports.pbkdf2Sync_sha512 = function(password, salt, iterations, keylen) {
|
|
var derivedKey = sjcl.misc.pbkdf2( password, salt, iterations, 512, hmacSHA512 );
|
|
return sjcl.codec.hex.fromBits( derivedKey )
|
|
};
|
|
|