diff options
Diffstat (limited to 'www/index.html')
-rw-r--r-- | www/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..09ab51c --- /dev/null +++ b/www/index.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html lang="en-GB"> +<head> +<meta charset="utf-8"> +<title>PassMan</title> +<link href="css/main.css" rel="stylesheet" id="stylelink"> +<script src="scripts/aes.js"></script> +</head> +<body> + +Source: <input type="text" id="source" value="Hello World"><br> +Passphrase: <input type="text" id="passphrase" value="Test"><br> +Result: <input type="text" id="result"><br> +Decrypted: <input type="text" id="decrypted"><br> +<input type="button" value="Encrypt" onclick="OnEncrypt()"> +<input type="button" value="Decrypt" onclick="OnDecrypt()"> +<input type="button" value="Clear" onclick="OnClear()"> + +<script> + +function OnEncrypt() +{ + var source = document.getElementById("source").value; + var phrase = document.getElementById("passphrase").value; + + var encryptedAES = CryptoJS.AES.encrypt(source, phrase); + + var str = encryptedAES.toString(); + + document.getElementById("result").value = str; +} + +function OnDecrypt() +{ + var source = document.getElementById("result").value; + var phrase = document.getElementById("passphrase").value; + + var decryptedBytes = CryptoJS.AES.decrypt(source, phrase); + + document.getElementById("decrypted").value = decryptedBytes.toString(CryptoJS.enc.Latin1); +} + +function OnClear() +{ + document.getElementById("decrypted").value = ""; +} + +</script> + +</body> +</html> + +<!-- vim: sw=4 ts=4 +--> |