|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
<title>Шифрование ссылки</title> |
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script> |
|
|
</head> |
|
|
<body> |
|
|
<h1>Шифрование ссылки</h1> |
|
|
<form id="encryptForm"> |
|
|
<label for="key">Ключ:</label> |
|
|
<input type="text" id="key" name="key" required><br><br> |
|
|
|
|
|
<label for="link">Ссылка:</label> |
|
|
<input type="text" id="link" name="link" required><br><br> |
|
|
|
|
|
<button type="button" onclick="encryptLink()">Зашифровать</button> |
|
|
</form> |
|
|
|
|
|
<h2>Зашифрованная ссылка:</h2> |
|
|
<textarea id="encryptedLink" rows="4" cols="50" readonly></textarea> |
|
|
|
|
|
<script> |
|
|
function encryptLink() { |
|
|
const key = document.getElementById('key').value; |
|
|
const link = document.getElementById('link').value; |
|
|
|
|
|
|
|
|
const encryptedLink = CryptoJS.HmacMD5(link, key).toString(); |
|
|
|
|
|
|
|
|
document.getElementById('encryptedLink').value = encryptedLink; |
|
|
} |
|
|
</script> |
|
|
</body> |
|
|
</html> |