-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·281 lines (222 loc) · 6.5 KB
/
script.js
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
// # Main Menu
// ## Function Cliboard
function clip_board(copy_text){
//Create Element
const Temporary = document.createElement('textarea');
//Set String
Temporary.value = copy_text;
//Place in Temporary Element
document.body.appendChild(Temporary);
//Select Text
Temporary.select();
//Copy Text to Clipboard
document.execCommand('copy');
//Remove the Temporary Element
document.body.removeChild(Temporary);
}
// ## Function Salt Word Generate
function salt_word(){
let result = '';
let alphabet = 'abcdefghijklmnopqrstuvwxyz';
let charactersLength = 26;
for (let i = 0; i < 10; i++){
result += alphabet.charAt(Math.floor(Math.random() * 26));
}
return result;
}
// ## Button Generate
function generate_hash(){
let key_str = document.getElementById("keyword").value;
let salt_str = document.getElementById("salt").value;
//Keyword String + Salt String
key_str += salt_str;
let SHA256 = new Hashes.SHA256().hex(key_str);
let SHA512 = new Hashes.SHA512().hex(key_str);
let HASHMD5 = new Hashes.MD5().hex(key_str);
document.getElementById("output_password_256").value = SHA256;
document.getElementById("output_password_512").value = SHA512;
document.getElementById("output_password_MD5").value = HASHMD5;
}
// ## Button Random Key
function random_key(){
//generate Keyword
let SHA256 = new Hashes.SHA512().hex(Math.random());
document.getElementById("keyword").value = SHA256;
//generate Salt
let salt_str = salt_word();
document.getElementById("salt").value = salt_str;
}
// ## Button Clear Key Input
function clear_keyword(){
let str = "";
document.getElementById("keyword").value = str;
}
// ## Button Clear Salt Input
function clear_salt(){
let str = "";
document.getElementById("salt").value = str;
}
// ## Button Clear Keys
function clear_all(){
let str = "";
clip_board("_");
document.getElementById("keyword").value = str;
document.getElementById("salt").value = str;
document.getElementById("output_password_256").value = str;
document.getElementById("output_password_512").value = str;
document.getElementById("output_password_MD5").value = str;
}
// # SHA256 Menu
// ## Button Copy 256 All
function copy_256_all(){
//Get Element to x
let x = document.getElementById("output_password_256");
// Make Password -> Text
x.type = "text";
let copyText = document.getElementById("output_password_256");
copyText.select();
document.execCommand("copy");
// Make Text -> Password
x.type = "password";
}
// ## Button Copy 256 First Chars
function copy_256_f(size){
//Get Element to x
let x = document.getElementById("output_password_256");
// Make Password -> Text
x.type = "text";
//Copy Value to String
let copyText = document.getElementById("output_password_256").value;
//Slice First
copyText = copyText.slice(0, size);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// ## Button Copy 256 Last Chars
function copy_256_l(size){
//Get Element to x
let x = document.getElementById("output_password_256");
// Make Password -> Text
x.type = "text";
//Copy Value to String
let copyText = document.getElementById("output_password_256").value;
//Save Size of String
let copy_length = copyText.length;
//Create a Start of Slice
let copy_start = copy_length - size;
//Slice Last
copyText = copyText.slice(copy_start, copy_length);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// # SHA512 Menu
// ## Button Copy 512 All
function copy_512_all(){
//Get Element to x
let x = document.getElementById("output_password_512");
// Make Password -> Text
x.type = "text";
let copyText = document.getElementById("output_password_512");
copyText.select();
document.execCommand("copy");
// Make Text -> Password
x.type = "password";
}
// ## Button Copy 512 First Chars
function copy_512_f(size){
//Get Element to x
let x = document.getElementById("output_password_512");
// Make Password -> Text
x.type = "text";
// Copy Value to String
let copyText = document.getElementById("output_password_512").value;
// Slice First
copyText = copyText.slice(0, size);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// ## Button Copy 512 Last Chars
function copy_512_l(size){
//Get Element to x
let x = document.getElementById("output_password_512");
// Make Password -> Text
x.type = "text";
//Copy Value to String
let copyText = document.getElementById("output_password_512").value;
//Save Size of String
let copy_length = copyText.length;
//Create a Start of Slice
let copy_start = copy_length - size;
//Slice Last
copyText = copyText.slice(copy_start, copy_length);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// # MD5 Menu
// ## Button Copy MD5 All
function copy_MD5_all(){
//Get Element to x
let x = document.getElementById("output_password_MD5");
// Make Password -> Text
x.type = "text";
let copyText = document.getElementById("output_password_MD5");
copyText.select();
document.execCommand("copy");
// Make Text -> Password
x.type = "password";
}
// ## Button Copy MD5 First Chars
function copy_MD5_f(size){
//Get Element to x
let x = document.getElementById("output_password_MD5");
// Make Password -> Text
x.type = "text";
// Copy Value to String
let copyText = document.getElementById("output_password_MD5").value;
// Slice First
copyText = copyText.slice(0, size);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// ## Button Copy MD5 Last Chars
function copy_MD5_l(size){
//Get Element to x
let x = document.getElementById("output_password_MD5");
// Make Password -> Text
x.type = "text";
//Copy Value to String
let copyText = document.getElementById("output_password_MD5").value;
//Save Size of String
let copy_length = copyText.length;
//Create a Start of Slice
let copy_start = copy_length - size;
//Slice Last
copyText = copyText.slice(copy_start, copy_length);
clip_board(copyText);
// Make Text -> Password
x.type = "password";
}
// # Re-Hash
// ## Button Re-Use HASH SHA256
function re_generate_hash_256(){
let str = document.getElementById("output_password_256").value;
document.getElementById("keyword").value = str;
generate_hash();
}
// ## Button Re-Use HASH SHA512
function re_generate_hash_512(){
let str = document.getElementById("output_password_512").value;
document.getElementById("keyword").value = str;
generate_hash();
}
// ## Button Re-Use HASH MD5
function re_generate_hash_MD5(){
let str = document.getElementById("output_password_MD5").value;
document.getElementById("keyword").value = str;
generate_hash();
}