games/tools/encrypt/index.html
2023-01-12 12:28:45 +01:00

36 lines
1.2 KiB
HTML

<h1>Encrypt data</h1>
<script src="jsaes.js"></script>
<form>
<label>Input data</label><br>
<textarea value="" rows="6" cols="80" id="input" required></textarea><br>
<label>Password:</label><br>
<input id="password" ><br>
<button type="button" onclick="doencode();">Encode</button>
<button type="button" onclick="dodecode();">Decode</button><br>
<label>Output</label><br>
<textarea id="output" rows="6" cols="80" readonly></textarea><br>
<button type="button" id="copy" onclick="docopy();">Copy</button>
</form>
<script>
function docopy() {
document.getElementById("output").select();
document.execCommand('copy');
}
function doencode() {
var password = document.getElementById("password").value
var output = btoa(document.getElementById("input").value)
AES_Init();
var block = document.getElementById("input").value
var key = document.getElementById("password").value
AES_ExpandKey(key);
document.getElementById("output").value = AES_Encrypt(block, key);
document.getElementById("output").value = AES_Done();
}
function dodecode() {
var password = document.getElementById("password").value
var output = atob(document.getElementById("input").value)
}
</script>