I am trying to add sha512 to a page for making the webpage more secure to make it harder for people to brute force the hash to get access to the secret in the url prams
heres the js:
(function() {
const GetPass = function() {
var usrpass = document.getElementById("userPassword").value;
const args = window.location.search;
const urlprams = new URLSearchParams(args);
var password = urlprams.get('password')
var hash = sha256(usrpass)
if (hash==password) {
var info = urlprams.get('secret')
var urle = atob(info)
var sec = decodeURI(urle)
const htm = sec.split("n")
htm.forEach(function (item, index) {
htm[index] = item + "<br/>"
});
var html = htm.join('')
document.body.innerHTML = (html);
document.title = 'reload to exit'
document.cookie = ''
} else {
alert('Incorrect Password!')
}
};
window.GetPass = GetPass;
})();
I tried using the crypto sha512 library but it errored out same with a function I tried