I wanted to make a password thing, and I have this code. It is a working password, but there is something I need help with. I have seen the entire code and I do not see the section where I can edit or view the password. Can someone help?
[[html]]
<style>
input,
button,
a,
h3 {
font-family: proxima-nova, sans-serif;
}
button {
transition: background-color .3s cubic-bezier(.4,0,.2,1),color .3s cubic-bezier(.4,0,.2,1);
border: .125rem solid rgba(48, 48, 52, 1);
border-radius: .25rem;
background-color: rgba(140, 136, 126, 1);
padding: .25rem;
color: rgb(237, 233, 223);
margin: 0 2px;
}
button:hover {
border: .125rem solid rgba(140, 136, 126, 1);
background-color: rgba(48, 48, 52, 1);
}
h3 {
margin: .5em 0 .4em;
padding: 0;
letter-spacing: .063rem;
}
a {
text-decoration: none;
color: rgb(230, 23, 68);
}
a:hover {
text-decoration: underline;
}
input {
font-size: 100%;
}
</style>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<div id="wrapper" style="background-color: #efefef;">
<div style="margin: auto; display: table;">
<input id="passwordInput"></input><button id="passwordButton">Enter</button>
</div>
<br />
<h3 style="text-align: center; opacity: 0;" id="wrongPassword">Wrong Password</h3>
</div>
<script>
function sha256(ascii) {
function rightRotate(value, amount) {
return (value >>> amount) | (value << (32 - amount));
}
var mathPow = Math.pow;
var maxWord = mathPow(2, 32);
var lengthProperty = "length";
var i, j;
var result = "";
var words = [];
var asciiBitLength = ascii[lengthProperty] * 8;
var hash = sha256.h = sha256.h || [];
var k = sha256.k = sha256.k || [];
var primeCounter = k[lengthProperty];
var isComposite = {};
for (var candidate = 2; primeCounter < 64; candidate++) {
if (!isComposite[candidate]) {
for (i = 0; i < 313; i += candidate) {
isComposite[i] = candidate;
}
hash[primeCounter] = (mathPow(candidate, .5) * maxWord) | 0;
k[primeCounter++] = (mathPow(candidate, 1 / 3) * maxWord) | 0;
}
}
ascii += "\x80";
while (ascii[lengthProperty] % 64 - 56) ascii += "\x00";
ascii += String.fromCharCode.apply(String, [0, 0, 0, 0].concat(asciiBitLength >>> 29));
ascii += String.fromCharCode.apply(String, [0, 0, 0].concat((asciiBitLength << 3) & maxWord));
for (i = 0; i < ascii[lengthProperty]; i += 4) {
words[i >> 2] = ascii.charCodeAt(i) << 24 | ascii.charCodeAt(i + 1) << 16 | ascii.charCodeAt(i + 2) << 8 | ascii.charCodeAt(i + 3);
}
var j, t1, t2, wordCopy, state = hash.slice(0);
for (i = 0; i < words[lengthProperty]; i += 16) {
j = 0;
state = hash.slice(0);
for (; j < 64; j++) {
wordCopy = words[i + j];
if (j < 16) {
t1 = wordCopy;
t1 = (t1 >>> 2) ^ (t1 >>> 13) ^ (t1 >>> 22);
t2 = (wordCopy >>> 6) ^ (wordCopy >>> 11) ^ (wordCopy >>> 25);
wordCopy = (wordCopy >>> 7) ^ (wordCopy >>> 18) ^ (wordCopy >>> 3);
wordCopy = (wordCopy + t2) | 0;
wordCopy = (wordCopy + state[j % 8]) | 0;
wordCopy |= 0;
state[j % 8] = (wordCopy + t1) | 0;
} else {
wordCopy = (state[(j + 1) % 8] + wordCopy) | 0;
wordCopy = (wordCopy + state[(j + 6) % 8]) | 0;
wordCopy = (wordCopy + state[(j + 3) % 8]) | 0;
t1 = wordCopy;
t1 = (t1 >>> 2) ^ (t1 >>> 13) ^ (t1 >>> 22);
t2 = (wordCopy >>> 6) ^ (wordCopy >>> 11) ^ (wordCopy >>> 25);
wordCopy = (wordCopy >>> 7) ^ (wordCopy >>> 18) ^ (wordCopy >>> 3);
wordCopy = (wordCopy + t2) | 0;
wordCopy = (wordCopy + state[j % 8]) | 0;
state[j % 8] = (wordCopy + t1) | 0;
}
}
for (j = 0; j < 8; j++) {
hash[j] = (hash[j] + state[j]) | 0;
}
}
for (i = 0; i < 8; i++) {
result += ((hash[i] >>> 28) & 0xf).toString(16) +
((hash[i] >>> 24) & 0xf).toString(16) +
((hash[i] >>> 20) & 0xf).toString(16) +
((hash[i] >>> 16) & 0xf).toString(16) +
((hash[i] >>> 12) & 0xf).toString(16) +
((hash[i] >>> 8) & 0xf).toString(16) +
((hash[i] >>> 4) & 0xf).toString(16) +
(hash[i] & 0xf).toString(16);
}
sha256.h = [];
sha256.k = [];
return result;
}
document.getElementById("passwordButton").addEventListener("click", function() {
const inputPassword = document.getElementById("passwordInput").value.toLowerCase();
const hashedPassword = sha256(inputPassword);
const expectedHash = "bc67437ffa1d2a66ebd148c73a967508bfe0880bd2c1b18a91e8b39bf2de1e5c";
if (hashedPassword === expectedHash) {
document.getElementById("wrapper").innerHTML = "";
} else {
document.getElementById("wrongPassword").style.opacity = 1;
}
document.getElementById("passwordInput").value = "";
});
</script>
[[/html]]