mirror of
https://codeberg.org/scip/digiproof.git
synced 2025-12-17 20:50:59 +01:00
12 lines
408 B
JavaScript
12 lines
408 B
JavaScript
|
|
/* 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;
|
||
|
|
}
|