-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
53 lines (42 loc) · 1.55 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
53
<!DOCTYPE html>
<html>
<head>
<title>Text / Base64 Converter</title>
</head>
<body>
<h1>Text / Base64 Converter</h1>
<div>
<label for="plaintextInput">Enter Plaintext:</label>
<input type="text" id="plaintextInput" placeholder="Type your plaintext here">
<button onclick="convertToBase64()">Convert to Base64</button>
</div>
<div>
<p><strong>Base64 Result:</strong></p>
<p id="base64Result"></p>
</div>
<div>
<label for="base64Input">Enter Base64 Text:</label>
<input type="text" id="base64Input" placeholder="Type your base64 text here">
<button onclick="convertToPlaintext()">Convert to Plaintext</button>
</div>
<div>
<p><strong>Plaintext Result:</strong></p>
<p id="plaintextResult"></p>
</div>
<script>
console.log("v3");
function convertToBase64() {
const plaintextInput = document.getElementById('plaintextInput');
const base64Result = document.getElementById('base64Result');
const base64Text = btoa(plaintextInput.value); // Convert to Base64
base64Result.textContent = base64Text;
}
function convertToPlaintext() {
const base64Input = document.getElementById('base64Input');
const plaintextResult = document.getElementById('plaintextResult');
const plaintext = atob(base64Input.value); // Convert to Plaintext, todo handle exceptions
plaintextResult.textContent = plaintext;
}
</script>
</body>
</html>