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.
24 lines
631 B
24 lines
631 B
|
|
|
|
const sha512crypt = require("sha512crypt-node"); |
|
|
|
|
|
const crypto = require("crypto"); |
|
|
|
window.addEventListener('DOMContentLoaded', () => { |
|
|
|
document.getElementById("hash-button").onclick = () => { |
|
document.getElementById("hash-result").value = sha512crypt.b64_sha512crypt( |
|
document.getElementById("hash-password").value, |
|
document.getElementById("hash-salt").value, |
|
); |
|
}; |
|
|
|
const setRandomSalt = () => { |
|
document.getElementById("hash-salt").value = Buffer.from(crypto.randomBytes(12)).toString('base64'); |
|
}; |
|
document.getElementById("salt-button").onclick = setRandomSalt; |
|
|
|
setRandomSalt(); |
|
|
|
}); |