-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhash.html
More file actions
253 lines (228 loc) · 7.12 KB
/
hash.html
File metadata and controls
253 lines (228 loc) · 7.12 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!DOCTYPE html>
<html lang="en">
<head>
<title>SHA-256</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<base target="_blank"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link rel="stylesheet" href="style.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=PT+Sans+Narrow:wght@400;700&family=Roboto:wght@300;400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=PT+Mono&display=swap');
</style>
<style>
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
body, #find-out {
font-family: 'Manrope', sans-serif;
font-size:16px;
}
.container {
flex-grow: 1;
}
a {
font-weight:bold;
text-decoration:underline;
}
#close, #showMore {
cursor:pointer;
}
.code {
font-family: 'PT Mono', monospace;
font-size:14px;
}
#main-div {
text-align:center; margin:0 auto;
}
input {
-webkit-border-radius:0;
border-radius:0;
width:150px;
text-align:center;
}
input, button {
border:0px;
font-size: inherit;
padding: 0.6em;
margin: 0.1em 0.2em;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
button {
margin-left:-7px;
font-weight:500;
padding-left:20px;
padding-right:20px;
color:white!important;
background: linear-gradient(68.78deg,#ff6ab4 -5.3%,#ffd569 124.36%)!important;
}
.headers {
font-weight:800;
text-align:center;
margin-bottom:20px;
font-size:20px;
}
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none;
}
#hash-input {
background:transparent;
border-bottom:2px solid black;
}
::placeholder {
color:#8f8f8f;
}
/* Mobile View */
@media (max-width:630px) {
input.middle:focus {
outline-width: 0;
}
#hash-input {
width:87%!important;
}
#main-div, footer {
max-width:320px;
}
h1 {
font-size:30px;
}
h3 {
font-size:18px;
}
input {
width:calc(100% - 108px);
}
}
#logo {
width:350px;
margin-top:0px;
margin-bottom:10px;
}
</style>
</head>
<body>
<div class="container" style="max-width:625px; width:100%;">
<img id="logo" src=logo.png width=350>
<br>
<div class="office-banner" style="display:none">
<div style="font-size:30px; margin-top:-15px">Lucky Number <span id="winner"></span></div>
</div>
<!--h3><i>Guess the Nonce to Mine a Block!</i></h3-->
<div id="main-div" style="margin-top:-50px">
<div style="margin-left: -1px; margin-right: -1px; margin-top: -1px; padding:15px; padding-top:50px; text-align:center;">
<div class="headers gradient-text" style="width:300px">SHA-256 Hash Generator</div>
<input style="width:90%; padding-right:20px;" placeholder="Input text to be hashed here" id="hash-input"></input>
<!--button onclick="sha256();" style="color:black; background:#5ddd9d">HASH</button-->
<br><br><br>
<div class="headers gradient-text">Result</div>
<div id="resultz" style="margin-top:-3px; line-height:24px">Hash around and find out</div>
<br>
</div>
</div>
<br><br>
</div> <!-- end container -->
<footer style="letter-spacing:1.1px; font-weight:400; font-size:14px; bottom:0px">
<div id="made-with" style="margin-bottom:5px; margin-top:5px">
<a href=https://twitter.com/d_plus__plus target="_blank" class="accent" style="font-size:16px">
Made with <span class="gradient-text">❤</span> by D++</a><br>
</div>
<div class="icon-container">
<a target="_blank" href="https://dplusplus.me"><div class="circle">
<i class="fas fa-link icon smaller"></i>
</div></a>
<a target="_blank" href="https://twitter.com/d_plus__plus"><div class="circle">
<i class="fab fa-twitter icon"></i>
</div></a>
<a target="_blank" href="https://instagram.com/d_plus_plus"><div class="circle">
<i class="fab fa-instagram icon bigger"></i>
</div></a>
<a target="_blank" href="https://dplus.plus/discord"><div class="circle">
<i class="fab fa-discord icon smaller"></i>
</div></a>
<a target="_blank" href="https://dplus.plus/telegram"><div class="circle">
<i class="fab fa-telegram-plane icon"></i>
</div></a>
<a target="_blank" href="https://dplus.plus/nostr"><div class="circle">
<i class="fas fa-feather icon slightly-smaller"></i>
</div></a>
</div>
</footer>
<!--script src="files/footer.js"></script-->
<script>
async function sha256() {
var message = $('#hash-input').val();
// encode as UTF-8
const msgBuffer = new TextEncoder().encode(message);
// hash the message
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
// convert ArrayBuffer to Array
const hashArray = Array.from(new Uint8Array(hashBuffer));
// convert bytes to hex string
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
if (message == "") {
$('#resultz').html("Hash around and find out");
$('#resultz').removeClass('code');
}
else {
$('#resultz').html(hashHex);
$('#resultz').addClass('code');
}
doLines();
}
var input = document.getElementById("hash-input");
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
sha256();
}
});
$('#hash-input').bind('keyup', function () {
sha256();
});
function glueLines() {
$('.code').each(function() {
var html = $(this).html();
html = html.replace('<br>','');
$(this).html(html);
});
}
function breakLines() {
$('.code').each(function() {
var html = $(this).html();
if (html.length > 32 && html.includes("<br>") == false) {
html = html.substring(0, 32) + "<br>" + html.substring(32);
$(this).html(html);
}
});
}
function doLines() {
var width = $(window).width();
if (width <= 630) {
breakLines();
}
else if (width > 630) {
glueLines();
}
}
$(window).resize(function() {
doLines();
});
doLines();
</script>
</body>
</html>