6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Victor Preston
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Hashing/script.js:
--------------------------------------------------------------------------------
1 | function generateHash() {
2 | var inputText = document.getElementById("input-text").value;
3 | var hashAlgorithm = document.getElementById("hash-algorithm").value;
4 | var hashResult = document.getElementById("hash-result");
5 |
6 | var hash;
7 |
8 | switch (hashAlgorithm) {
9 | case "sha1":
10 | hash = sha1(inputText);
11 | break;
12 | case "md5":
13 | hash = md5(inputText);
14 | break;
15 | case "md2":
16 | hash = md2(inputText);
17 | break;
18 | case "sha256":
19 | hash = sha256(inputText);
20 | break;
21 | case "sha512":
22 | hash = sha512(inputText);
23 | break;
24 | default:
25 | hash = "Invalid algorithm";
26 | }
27 |
28 | hashResult.value = hash;
29 | }
30 |
31 | // SHA-1 hashing algorithm implementation
32 | function sha1(input) {
33 | var sha1Hash = CryptoJS.SHA1(input);
34 | return sha1Hash.toString();
35 | }
36 |
37 | // MD5 hashing algorithm implementation
38 | function md5(input) {
39 | var md5Hash = CryptoJS.MD5(input);
40 | return md5Hash.toString();
41 | }
42 |
43 | // MD2 hashing algorithm implementation
44 | function md2(input) {
45 | var md2Hash = CryptoJS.MD2(input);
46 | return md2Hash.toString();
47 | }
48 |
49 | // SHA-256 hashing algorithm implementation
50 | function sha256(input) {
51 | var sha256Hash = CryptoJS.SHA256(input);
52 | return sha256Hash.toString();
53 | }
54 |
55 | // SHA-512 hashing algorithm implementation
56 | function sha512(input) {
57 | var sha512Hash = CryptoJS.SHA512(input);
58 | return sha512Hash.toString();
59 | }
60 |
61 | function clearHash() {
62 | document.getElementById("hash-result").value = "";
63 | }
--------------------------------------------------------------------------------
/Hashing/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Online Hash Generator
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |