-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (51 loc) · 1.8 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
<!doctype html>
<html>
<head>
<title>AES Crypto</title>
<style type="text/css">
body { width: 600px; margin: 20px auto; }
label { display: block; }
div { margin-top: 20px; }
div#controls, div#help { text-align: center; }
div#controls a { margin: 20px 20px; }
textarea { width: 600px; height: 100px; }
input { width: 400px; }
</style>
<script type="text/javascript" src="aes.js"></script>
<script type="text/javascript">
function encrypt()
{
var passphrase = document.getElementById('passphrase').value;
var plaintext = document.getElementById('plaintext').value;
var ciphertext_val = CryptoJS.AES.encrypt(plaintext, passphrase);
document.getElementById('ciphertext').value = ciphertext_val.toString().replace(/(.{80})/g, "$1\n");
}
function decrypt()
{
var passphrase = document.getElementById('passphrase').value;
var ciphertext = document.getElementById('ciphertext').value.replace(/[\r\n]/g, "");
var plaintext_val = CryptoJS.AES.decrypt(ciphertext, passphrase).toString(CryptoJS.enc.Utf8);
document.getElementById('plaintext').value = plaintext_val;
}
</script>
</head>
<body>
<label for="passphrase">Passphrase (<a href="https://pwgen.foxfilm.com" target="_blank">generator</a>):</label>
<input type="text" id="passphrase">
<div id="plaintext_div">
<label for="plaintext">Plaintext (decrypted text):</label>
<textarea id="plaintext" wrap="soft"></textarea>
</div>
<div id="controls">
<a href="" onclick="decrypt(); return false;"><< Decrypt</a>
<a href="" onclick="encrypt(); return false;">Encrypt >></a>
</div>
<div id="ciphertext_div">
<label for="ciphertext">Ciphertext (encrypted text):</label>
<textarea id="ciphertext" wrap="soft"></textarea>
</div>
<div id="help">
<a href="retrieve_password.mp4">Help!</a>
</div>
</body>
</html>