Use hmac instead of a second pbkdf

This commit is contained in:
Esteban Ordano 2014-11-04 11:47:38 -03:00
commit 49fbf2c849
4 changed files with 51 additions and 28 deletions

View file

@ -23,6 +23,17 @@ module.exports = {
);
},
/**
* @param {string} key
* @param {string} data
* @return {string} base64 encoded hmac
*/
hmac: function(key, data) {
return sjcl.codec.base64.fromBits(
new sjcl.misc.hmac(key, sjcl.hash.sha256).encrypt(data)
);
},
/**
* @param {string} password
* @param {string} salt - base64 encoded, defaults to 'mjuBtGybi/4='