-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
153 lines (142 loc) Β· 6.28 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<!-- SPDX-FileCopyrightText: (C) 2024 Dmitriy Titarenko https://github.com/dscheg -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>AES Crypto Playground</title>
<meta http-equiv="Content-Security-Policy" content="default-src 'self';script-src 'self' cdnjs.cloudflare.com;font-src 'self' cdnjs.cloudflare.com;"/>
<meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1.0,user-scalable=no"/>
<link href="hex.css" rel="stylesheet" type="text/css"/>
<link href="aes.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div id="theme">🌙︎</div>
<h1>AES Crypto Playground</h1>
<div class="note">Play around with AES encryption and decryption to learn about the different complexities of symmetric encryption implementations. This page uses only client-side cryptography and does not send data anywhere. But still, do not play with sensitive data. The playground provided "AS IS" without any warranties</div>
<br/>
<table class="params">
<tr><td>Mode</td><td><select id="mode">
<option value="CBC">CBC (default)</option>
<option value="ECB">ECB</option>
<option value="CTR">CTR</option>
<option value="OFB">OFB</option>
<option value="CFB">CFB</option>
</select></td><td id="mode-img" rowspan=8></td></tr>
<tr><td>Padding</td><td><select id="padding">
<option value="Pkcs7">PKCS7 (default)</option>
<option value="AnsiX923">ANSI X9.23</option>
<option value="Iso10126">ISO 10126</option>
<option value="Iso97971">ISO/IEC 9797-1</option>
<option value="ZeroPadding">Zero Padding</option>
<option value="NoPadding">No Padding</option>
</select></td></tr>
<tr><td>IV</td><td><input type="text" id="iv" maxlength=32 pattern="[0-9a-fA-F]*"/></td></tr>
<tr><td>Key</td><td><input type="text" id="key" maxlength=64 pattern="[0-9a-fA-F]*"/></td></tr>
<tr><td>Key Size</td><td><input type="text" id="keysize" disabled value="128 bit"/></td></tr>
<tr><td>Block Size</td><td><input type="text" id="blocksize" disabled value="128 bit"/></td></tr>
<tr><td>Compression</td><td><select id="compress">
<option value="">No Compression</option>
<option value="deflate-raw">Deflate Raw</option>
<option value="deflate">Deflate</option>
<option value="gzip">Gzip</option>
</select></td></tr>
<tr><td class="dir-td" colspan=3><select id="dir">
<option value="Decryption">Decryption</option>
<option value="Encryption">Encryption</option>
</td></tr>
</table>
<h3>Plain</h3>
<table class="xed plain">
<tr>
<td>
<input type="file" class="xed-load-file" hidden/>
<button class="xed-load" title="Load">π︎</button>
<button class="xed-save" title="Save">πΎ︎</button>
</td>
<td class="xed-top"></td><td class="xed-size"></td>
</tr>
<tr>
<td><textarea class="xed-left" cols=8 wrap="off" spellcheck="false" readonly>00000000</textarea></td>
<td><textarea class="xed-hex" cols=47 wrap="off" spellcheck="false"></textarea>
<td><textarea class="xed-right" cols=16 wrap="off" autofocus spellcheck="false"></textarea></td>
</tr>
</table>
<h3 hidden>Compressed</h3>
<table class="xed deflate" hidden>
<tr>
<td>
<input type="file" class="xed-load-file" hidden/>
<button class="xed-load" title="Load">π︎</button>
<button class="xed-save" title="Save">πΎ︎</button>
</td>
<td class="xed-top"></td><td class="xed-size"></td>
</tr>
<tr>
<td><textarea class="xed-left" cols=8 wrap="off" spellcheck="false" readonly>00000000</textarea></td>
<td><textarea class="xed-hex" cols=47 wrap="off" spellcheck="false"></textarea>
<td><textarea class="xed-right" cols=16 wrap="off" spellcheck="false"></textarea></td>
</tr>
</table>
<h3>Cipher</h3>
<table class="xed cipher">
<tr>
<td>
<input type="file" class="xed-load-file" hidden/>
<button class="xed-load" title="Load">π︎</button>
<button class="xed-save" title="Save">πΎ︎</button>
</td>
<td class="xed-top"></td><td class="xed-size"></td>
</tr>
<tr>
<td><textarea class="xed-left" cols=8 wrap="off" spellcheck="false" readonly>00000000</textarea></td>
<td><textarea class="xed-hex" cols=47 wrap="off" spellcheck="false"></textarea>
<td><textarea class="xed-right" cols=16 wrap="off" spellcheck="false"></textarea></td>
</tr>
</table>
<h3>Decrypted</h3>
<table class="xed decrypt">
<tr>
<td>
<input type="file" class="xed-load-file" hidden/>
<button class="xed-load" title="Load">π︎</button>
<button class="xed-save" title="Save">πΎ︎</button>
</td>
<td class="xed-top"></td><td class="xed-size"></td>
</tr>
<tr>
<td><textarea class="xed-left" cols=8 wrap="off" spellcheck="false" readonly>00000000</textarea></td>
<td><textarea class="xed-hex" cols=47 wrap="off" spellcheck="false" readonly></textarea>
<td><textarea class="xed-right" cols=16 wrap="off" spellcheck="false" readonly></textarea></td>
</tr>
</table>
<h3 class="grayed">XOR Lines</h3>
<table class="xed xor">
<tr>
<td>
<input type="file" class="xed-load-file" hidden/>
<button class="xed-load" title="Load">π︎</button>
<button class="xed-save" title="Save">πΎ︎</button>
</td>
<td class="xed-top"></td><td class="xed-size"></td>
</tr>
<tr>
<td><textarea class="xed-left" cols=8 wrap="off" spellcheck="false" readonly>00000000</textarea></td>
<td><textarea class="xed-hex" cols=47 wrap="off" spellcheck="false"></textarea>
<td><textarea class="xed-right" cols=16 wrap="off" spellcheck="false"></textarea></td>
</tr>
<tr>
<td></td>
<td><textarea id="xor-hex" cols=47 wrap="off" spellcheck="false" readonly></textarea>
<td><textarea id="xor-right" cols=16 wrap="off" spellcheck="false" readonly></textarea></td>
</tr>
</table>
<h3>Result</h3>
<textarea id="result" rows=5 spellcheck="false" readonly>n/a</textarea>
<div class="copy"><a href="https://github.com/dscheg/aes">github.com/dscheg/aes</a></div>
<script src="hex.js"></script>
<!-- Default subtle crypto implementation has some limitations, so use crypto-js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js" integrity="sha512-a+SUDuwNzXDvz4XrIcXHuCf089/iJAoN4lmrXJg18XnduKK6YlDHNRalv4yd1N40OKI80tFidF+rqTFKGPoWFQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="aes.js"></script>
</html>