Create crypto.html
Browse files- crypto.html +37 -0
crypto.html
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Шифрование ссылки</title>
|
7 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
8 |
+
</head>
|
9 |
+
<body>
|
10 |
+
<h1>Шифрование ссылки</h1>
|
11 |
+
<form id="encryptForm">
|
12 |
+
<label for="key">Ключ:</label>
|
13 |
+
<input type="text" id="key" name="key" required><br><br>
|
14 |
+
|
15 |
+
<label for="link">Ссылка:</label>
|
16 |
+
<input type="text" id="link" name="link" required><br><br>
|
17 |
+
|
18 |
+
<button type="button" onclick="encryptLink()">Зашифровать</button>
|
19 |
+
</form>
|
20 |
+
|
21 |
+
<h2>Зашифрованная ссылка:</h2>
|
22 |
+
<textarea id="encryptedLink" rows="4" cols="50" readonly></textarea>
|
23 |
+
|
24 |
+
<script>
|
25 |
+
function encryptLink() {
|
26 |
+
const key = document.getElementById('key').value;
|
27 |
+
const link = document.getElementById('link').value;
|
28 |
+
|
29 |
+
// Шифрование с использованием MD5
|
30 |
+
const encryptedLink = CryptoJS.HmacMD5(link, key).toString();
|
31 |
+
|
32 |
+
// Вывод зашифрованной ссылки
|
33 |
+
document.getElementById('encryptedLink').value = encryptedLink;
|
34 |
+
}
|
35 |
+
</script>
|
36 |
+
</body>
|
37 |
+
</html>
|