This commit is contained in:
Boof 2023-04-17 11:12:44 +02:00 committed by GitHub
parent 4daeebf094
commit f0b01f1e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 0 deletions

20
tools/encoder/index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="index.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<label>Input data</label><br>
<textarea style="width: 90%;" value="" rows="6" cols="80" id="input" required></textarea><br>
<button class="button" id="encodebutton" type="button" onclick="doencode();">Encode</button>
<button type="button" id="decodebutton" class="button" onclick="dodecode();">Decode</button><br>
<label>Output</label><br>
<textarea style="width: 90%;" id="output" rows="6" cols="80" readonly></textarea><br>
<button class="button" type="button" id="copy" onclick="docopy();">Copy</button>
</body>
</html>

25
tools/encoder/index.js Normal file
View File

@ -0,0 +1,25 @@
//Copies the text from the output
function docopy() {
document.getElementById("output").select();
document.execCommand('copy');
}
function doencode() {
var inputData = document.getElementById("input").value;
var outputdata = rot13(inputData);
document.getElementById("output").value = outputdata;
}
function dodecode() {
var inputData = document.getElementById("input").value;
var outputdata = rot13(inputData);
document.getElementById("output").value = outputdata;
}
//Rot13 cipher
function rot13(message) {
return message.replace(/[a-z]/gi, letter => String.fromCharCode(letter.charCodeAt(0) + (letter.toLowerCase() <= 'm' ? 13 : -13)));
}

0
tools/encoder/style.css Normal file
View File