diff options
author | Ian C <ianc@noddybox.co.uk> | 2018-06-25 15:04:16 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2018-06-25 15:04:16 +0000 |
commit | a54dd4e961816a13054a6f561418908e13c64b5a (patch) | |
tree | 4554c8ba5c99ff850ad26013de1873beb8246dcb | |
parent | db675a214185996b3334acf81ac5ea7e3e9ff43b (diff) |
Basic HTML framework and created initial JavaScript.
-rw-r--r-- | www/index.html | 44 | ||||
-rw-r--r-- | www/scripts/main.js | 16 |
2 files changed, 24 insertions, 36 deletions
diff --git a/www/index.html b/www/index.html index 09ab51c..ad0c0ed 100644 --- a/www/index.html +++ b/www/index.html @@ -5,47 +5,19 @@ <title>PassMan</title> <link href="css/main.css" rel="stylesheet" id="stylelink"> <script src="scripts/aes.js"></script> +<script src="scripts/main.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()"> +<div> +Passphrase: <input type="password" id="PassPhrase"> + + +<input type="button" id="LoadButton" value="Load" onclick="DoLoad"> -<script> +<hr> -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> +<table id="DataTable"></table> </body> </html> diff --git a/www/scripts/main.js b/www/scripts/main.js new file mode 100644 index 0000000..e3c1f7b --- /dev/null +++ b/www/scripts/main.js @@ -0,0 +1,16 @@ + +function AESEncrypt(source, phrase) +{ + var encryptedAES = CryptoJS.AES.encrypt(source, phrase); + + return encryptedAES.toString(); +} + +function AESDecrypt(source, phrase) +{ + var decryptedBytes = CryptoJS.AES.decrypt(source, phrase); + + return decryptedBytes.toString(CryptoJS.enc.Latin1); +} + +// vim: sw=4 ts=4 |