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(); });