-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
521 lines (465 loc) · 16.1 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
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kashword Generator</title>
<!-- Link to favicon -->
<link rel="icon" type="image/x-icon" href="/Kashword/image/favicon.ico?">
<!-- Responsive viewport meta tag -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* CSS styles */
/* Importing Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Black+Ops+One&family=Caveat&family=Exo:wght@500&family=Share+Tech+Mono&family=Silkscreen&display=swap');
/* General styles for the body */
body {
margin: 0;
width: 100vw;
height: 100vh;
background: #222; /* Dark background */
display: flex;
align-items: center;
text-align: center;
justify-content: center;
place-items: center;
overflow: hidden;
font-family: 'Exo', sans-serif;
color: #fff; /* Light text color */
}
/* Container styles */
.container {
position: relative;
width: 315px;
height: 550px;
border-radius: 17px;
padding: 34px;
box-sizing: border-box;
background: #222; /* Dark container background */
box-shadow: 14px 14px 20px #111, -14px -14px 20px #333; /* Neumorphic shadow */
}
/* Brand logo styles */
.brand-logo {
height: 85px;
width: 85px;
object-fit: fill;
margin: auto;
border-radius: 50%;
box-sizing: border-box;
box-shadow: 7px 7px 10px #111, -7px -7px 10px #333; /* Neumorphic shadow */
}
/* Brand title styles */
.brand-title {
padding-top: 8.5px;
margin-top: 8.5px;
font-weight: 900;
font-size: 1.53rem;
color: #0e8ef9;
letter-spacing: 1px;
}
/* Input container styles */
.inputs {
text-align: left;
margin-top: 25.5px;
}
/* Common styles for label, input, and button */
label,
input,
button {
display: block;
width: 100%;
font-size: 11.9px;
padding: 0;
border: none;
outline: none;
box-sizing: border-box;
}
/* Styles for labels */
label {
margin-bottom: 3.4px;
}
label:nth-of-type(2) {
margin-top: 10.2px;
}
.vault{
background: #222; /* Dark input background */
padding: 8.5px;
padding-left: 17px;
height: 42.5px;
font-size: 11.9px;
border-radius: 12.75px;
box-shadow: inset 3.5px 3.5px 3.5px #111, inset -3.5px -3.5px 3.5px #333; /* Neumorphic inset shadow */
color: #fff; /* Light text color */
margin-bottom: 12.75px; /* Adjusted margin-bottom */
}
/* Input styles for password, number, and textarea */
textarea {
background: #222; /* Dark input background */
padding: 8.5px;
padding-left: 17px;
height: 42.5px;
font-size: 11.9px;
border-radius: 12.75px;
box-shadow: inset 3.5px 3.5px 3.5px #111, inset -3.5px -3.5px 3.5px #333; /* Neumorphic inset shadow */
color: #fff; /* Light text color */
margin-bottom: 12.75px; /* Adjusted margin-bottom */
}
/* Placeholder color */
input::placeholder {
color: #5c5470;
}
/* Button styles */
.btn {
color: #fff;
background: #1DA1F0;
height: 34px;
border-radius: 17px;
cursor: pointer;
font-weight: 900;
box-shadow: 3.5px 3.5px 3.5px #111, -3.5px -3.5px 3.5px #333; /* Neumorphic shadow */
transition: 0.5s;
}
/* Button hover effect */
.btn:hover {
box-shadow: none;
}
/* Output area styles */
.output-area {
background-color: #222; /* Dark output area background */
padding: 4.25px;
margin-top: 17px;
position: relative;
}
/* Output textarea styles */
.output-area textarea {
width: calc(100% - 22px);
margin-bottom: 21.25px; /* Adjusted margin-bottom */
height: 42.5px;
border: 1px solid #222; /* Dark border */
border-radius: 4px;
padding: 8.5px;
resize: none;
font-size: 12.5px;
background-color: #222; /* Dark textarea background */
color: #fff; /* Light text color */
}
/* Copy button styles */
.copy-btn {
position: absolute;
bottom: 0px; /* Adjusted position */
right: 0px; /* Adjusted position */
background-color: #24cfaa;
color: #fff;
border: none;
padding: 4.25px;
border-radius: 3.4px;
cursor: pointer;
font-size: 11.9px;
}
/* Copy button hover effect */
.copy-btn:hover {
background-color: #02c8db;
}
/* Reveal password styles */
.reveal-password {
position: absolute;
font-size: 10.2px;
top: 15.3px;
right: 12.75px;
cursor: pointer;
color: #786d92;
z-index: 1;
}
/* Input wrapper styles */
.input-wrapper {
position: relative;
}
.starting-area,
.length-area {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
place-items: center;
margin-bottom: 12.75px; /* Adjusted margin-bottom */
}
.box {
position: relative;
width: 34px;
background: #222; /* Dark input background */
padding: 8.5px;
padding-left: 8.5px;
height: 34px;
font-size: 11.9px;
text-align: center;
border-radius: 3.4px;
box-shadow: inset 3.5px 3.5px 3.5px #111, inset -3.5px -3.5px 3.5px #333; /* Neumorphic inset shadow */
color: #5c5470; /* Light text color */
}
.starting-group,
.length-group {
color: #786d92; /* Light text color */
font-size: 11.9px;
text-align: center;
width: 340px;
margin-left: 4.25px;
}
/* Range slider styles */
.slider {
width: 100%;
height: 12.75px;
border-radius: 10px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider::-webkit-slider-thumb {
appearance: none;
width: 21.25px;
height: 21.25px;
border-radius: 50%;
background: #1DA1F0;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 21.25px;
height: 21.25px;
border-radius: 50%;
background: #1DA1F0;
cursor: pointer;
}
.hash-area
{
display: flex;
align-items: center;
text-align: center;
justify-content: center;
place-items: center;
margin-bottom: 12.75px; /* Adjusted margin-bottom */
}
.hash-label
{
color: #786d92; /* Light text color */
font-size: 11.9px;
text-align: left;
width: 120px;
/* margin-left: 4.25px;*/
}
/*
.hash-drop-down
{
color: #786d92;
font-size: 11.9px;
text-align: center;
width: 340px;
}
*/
/* Styling the dropdown container */
.hash-drop-down {
min-width: 120px;
appearance: none; /* Removes default dropdown styling */
background-color: #222; /* Darker background for dropdown */
color: #786d92; /* Light text color */
padding: 8px 12px; /* Adds padding */
border-radius: 4px; /* Rounded corners */
box-shadow: inset 2px 2px 5px #111, inset -2px -2px 5px #444; /* Neumorphic shadow */
border: none; /* Removes default border */
cursor: pointer;
transition: background-color 0.3s ease; /* Smooth transition on hover */
text-align: center;
}
/* Dropdown hover effect */
.hash-drop-down:hover {
background-color: #; /* Slightly lighter background on hover */
}
/* Dropdown focus outline */
.hash-drop-down:focus {
outline: none;
box-shadow: 0 0 0 1px #; /* Blue outline on focus */
}
/* Styling dropdown options */
.hash-drop-down option {
background-color: #222; /* Background color for options */
color: #786d92; /* Text color */
padding: 10px; /* Adds padding to options */
}
</style>
</head>
<body>
<div class="container">
<!-- Brand logo -->
<img class="brand-logo" src="/Kashword/image/logo.png?" >
<!-- Brand title -->
<div class="brand-title">Kashword</div>
<!-- Inputs section -->
<div class="inputs">
<div class="input-wrapper">
<!-- Input field for entering text -->
<input class="vault" type="password" id="input" name="input" placeholder="type here..." required>
<!-- Span for revealing password -->
<span class="reveal-password" onclick="revealPassword()">Show</span>
<div class="adjust">
<div class="hash-area">
<!-- Ha shing Algorithm Selection -->
<label class="hash-label" for="algorithm">Hashing Algorithm:</label>
<select id="algorithm" class="hash-drop-down" onchange="updateSliderLimits()">
<option value="sha-256">SHA-256</option>
<option value="sha-512">SHA-512</option>
<option value="sha-1">SHA-1</option>
<option value="sha-384">SHA-384</option>
</select>
</div>
<div class="starting-area">
<!-- Left text input box to display starting point value -->
<input class="box" type="text" id="leftValue" name="leftValue" oninput="updateSlider()" placeholder="0">
<div class="starting-group">
<div>Starting Point</div>
<!-- Range slider for starting point -->
<input type="range" id="startingPoint" name="startingPoint" min="0" max="64" value="0" class="slider" oninput="updateTextInput(this.value, 'leftValue')">
</div>
</div>
<div class="length-area">
<!-- Right text input box to display length value -->
<input class="box" type="text" id="rightValue" name="rightValue" oninput="updateSlider()" placeholder="15">
<div class="length-group">
<div>Length</div>
<!-- Range slider for length -->
<input type="range" id="length" name="length" min="1" max="64" value="15" class="slider" oninput="updateTextInput(this.value, 'rightValue')">
</div>
</div>
</div>
<!-- Button for generating Kashword -->
<button type="button" class="btn btn-primary" onclick="generateHash()">Generate Kashword</button>
</div>
</div>
<!-- Output area -->
<div class="output-area">
<!-- Textarea for displaying Kashword -->
<textarea id="output" readonly></textarea>
<!-- Button for copying Kashword to clipboard -->
<button id="copy" class="copy-btn" onclick="copyHash()">Copy</button>
</div>
</div>
<script>
// Function to compute SHA-256 hash of a message
async function sha256(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
// Function to compute SHA-512 hash of a message
async function sha512(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-512', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
// Function to compute SHA-1 hash of a message
async function sha1(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-1', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
// Function to compute SHA-384 hash of a message
async function sha384(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-384', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
// Function to generate Kashword
function generateHash() {
const inputText = document.getElementById('input').value;
const startingPoint = parseInt(document.getElementById('startingPoint').value);
const length = parseInt(document.getElementById('length').value);
// Compute SHA-256 hash and extract characters based on starting point and length
sha256(inputText).then(hash => {
const kashword = hash.substring(startingPoint, startingPoint + length);
// Display Kashword in the output textarea
document.getElementById('output').value = kashword;
});
}
// Function to copy Kashword to clipboard
function copyHash() {
const output = document.getElementById('output');
output.select();
document.execCommand('copy');
}
// Function to reveal or hide password
function revealPassword() {
const input = document.getElementById('input');
if (input.type === 'password') {
input.type = 'text';
document.querySelector('.reveal-password').innerText = 'Hide';
} else {
input.type = 'password';
document.querySelector('.reveal-password').innerText = 'Show';
}
}
// Function to update slider values based on text input
function updateSlider() {
const leftValue = parseInt(document.getElementById('leftValue').value);
const rightValue = parseInt(document.getElementById('rightValue').value);
document.getElementById('startingPoint').value = leftValue;
document.getElementById('length').value = rightValue;
}
// Function to update text input values based on slider positions
function updateTextInput(val, id) {
document.getElementById(id).value = val;
}
async function generateHash() {
const inputText = document.getElementById('input').value;
const algorithm = document.getElementById('algorithm').value;
const startingPoint = parseInt(document.getElementById('startingPoint').value);
const length = parseInt(document.getElementById('length').value);
let hash;
if (algorithm === 'sha-256') {
hash = await sha256(inputText);
} else if (algorithm === 'sha-512') {
hash = await sha512(inputText); // Define a similar function for SHA-512 if needed
} else if (algorithm === 'sha-1') {
hash = await sha1(inputText); // Define a similar function for sha1 if needed
} else if (algorithm === 'sha-384') {
hash = await sha384(inputText); // Define a similar function for sha1 if needed
}
const kashword = hash.substring(startingPoint, startingPoint + length);
document.getElementById('output').value = kashword;
}
function updateSliderLimits() {
const algorithm = document.getElementById('algorithm').value;
const startingPointSlider = document.getElementById('startingPoint');
const lengthSlider = document.getElementById('length');
let maxLength;
// Set maxLength based on the selected algorithm
if (algorithm === 'sha-256') {
maxLength = 64;
} else if (algorithm === 'sha-512') {
maxLength = 128;
} else if (algorithm === 'sha-1') {
maxLength = 40;
} else if (algorithm === 'sha-384') {
maxLength = 96;
}
// Update slider maximum values based on maxLength
startingPointSlider.max = maxLength;
lengthSlider.max = maxLength;
// Reset sliders if they exceed new max
if (parseInt(startingPointSlider.value) > maxLength) {
startingPointSlider.value = 0;
}
if (parseInt(lengthSlider.value) > maxLength) {
lengthSlider.value = maxLength;
}
// Update displayed values
document.getElementById('leftValue').value = startingPointSlider.value;
document.getElementById('rightValue').value = lengthSlider.value;
}
</script>
</body>
</html>