Files
digiproof/js/security.js
git@daemon.de 5992bf159b initial commit
2013-09-12 23:13:49 +02:00

12 lines
408 B
JavaScript
Executable File

/* crypto helpers */
function pwhash(pass) {
/* get the clear text password, generate a salt
and hash them together. return the hash */
var salt = CryptoJS.lib.WordArray.random(128/8);
console.log("key: %s, salt: %s", pass, salt);
var key512iter32 = CryptoJS.PBKDF2(pass, salt,{ keySize: 512/32, iterations: 32, hasher: CryptoJS.algo.SHA512 });
return key512iter32;
}