-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpass.html
More file actions
37 lines (33 loc) · 1015 Bytes
/
Copy pathpass.html
File metadata and controls
37 lines (33 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password</title>
<meta name="robots" content="noindex, nofollow">
</head>
<body>
<input type="password" id="password" placeholder="Password">
<button onclick="checkPassword()">Enter</button>
<script>
const PASSWORD_HASH = "751c32488568643299e72de282e9900d63ceae4fd87b5cbd2b54f4be26f8a039";
async function sha256(text) {
const data = new TextEncoder().encode(text);
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
return [...new Uint8Array(hashBuffer)]
.map(b => b.toString(16).padStart(2, "0"))
.join("");
}
async function checkPassword() {
const password = document.getElementById("password").value;
const hash = await sha256(password);
if (hash === PASSWORD_HASH) {
localStorage.setItem("password_correct", "true");
location.href = "index.html";
} else {
alert("Incorrect password");
}
}
</script>
</body>
</html>