-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (80 loc) · 2.56 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hasher</title>
<style>
@import url(./tailwind.min.css);
html,
body {
font-family: "Montserrat", sans-serif;
}
.anim {
transition-duration: 500ms;
}
</style>
<script>
window.onload = () => {
const baseUrl = window.location.href
.split("/")
.slice(0, -1)
.join("/")
.replace("static", "call");
document.getElementById("sub").addEventListener("click", (e) => {
e.preventDefault();
const inp = document.getElementById("textinp").value;
if (inp) {
fetch(`${baseUrl}/getHash`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
text: inp,
}),
})
.then((res) => res.json())
.then(({ hashes }) => {
document.getElementById("hashes").innerHTML = `
<h3 class="text-gray-900 font-bold">MD5: ${hashes.md5}</h3>
<h3 class="text-gray-900 font-bold">SHA1: ${hashes.sha1}</h3>
<h3 class="text-gray-900 font-bold">SHA256: ${hashes.sha256}</h3>
<h3 class="text-gray-900 font-bold">SHA512: ${hashes.sha512}</h3>
`;
});
}
});
};
</script>
</head>
<body>
<div class="h-screen w-screen bg-gray-900 flex items-center justify-center">
<div class="bg-white rounded-lg shadow-2xl p-8">
<h1 class="text-3xl font-black">
Hasher
</h1>
<form class="flex my-4" id="hashform">
<input
placeholder="Enter text to hash"
id="textinp"
class="shadow-md appearance-none border w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-xl hover:shadow-xl transition anim"
/>
<button
type="submit"
id="sub"
class="bg-gray-900 text-white text-center items-center flex justify-center px-4 shadow-lg"
>
→
</button>
</form>
<div id="hashes">
<h3 class="text-gray-900 font-bold">MD5:</h3>
<h3 class="text-gray-900 font-bold">SHA1:</h3>
<h3 class="text-gray-900 font-bold">SHA256:</h3>
<h3 class="text-gray-900 font-bold">SHA512:</h3>
</div>
</div>
</div>
</body>
</html>