diff --git a/aes.css b/aes.css index cb77d29..31869b1 100644 --- a/aes.css +++ b/aes.css @@ -56,15 +56,14 @@ input { #mode-img { transition: 0.2s filter linear; - background: 10px 0 / contain no-repeat; - filter: drop-shadow(0px 0px 10px #07f); + filter: drop-shadow(2px 4px 6px #222); + background: 10px center / contain no-repeat; position: relative; width: 99%; - translate: 0 -4px; - transform: scaleY(1.1); + translate: 0 -6px; } .night #mode-img { - filter: drop-shadow(0px 0px 10px #f50); + filter: drop-shadow(2px 4px 6px #f50); } #mode-img.mode-CBC-Decryption { background-image: url("modes/CBC_decryption.min.svg"); diff --git a/aes.js b/aes.js index 65b29dd..dc6fcfe 100644 --- a/aes.js +++ b/aes.js @@ -155,18 +155,13 @@ $cipher.addEventListener("change", e => { $xor.addEventListener("change", e => { const data = $xor.getData(); - if((data.length & 15) !== 0) { - setResult(false, "Size must be multiple to AES block size"); - return; - } let result = new Uint8Array(16); - for(var row = 0; row < (data.length >> 4); row++) - for(var col = 0; col < 16; col++) { - result[col] ^= data[(row << 4) + col]; - } + for(var idx = 0; idx < data.length; idx++) + result[idx & 15] ^= data[idx]; - setResult(true, toHex(result).replace(/([0-9A-F]{2})/ig, '$1 ')); + $("#xor-hex").value = toHex(result).replace(/([0-9A-F]{2})(?=.)/ig, '$1 '); + $("#xor-right").value = Array.from(result).map(c => String.fromCodePoint(c + (0x20 <= c && c < 0x7F ? 0 : 0xF000))).join(''); }, false); $plain.setDataHex(localStorage.getItem("hex") || toHex(new TextEncoder().encode('{"name":"hack"}'))); diff --git a/hex.js b/hex.js index 66ab56b..9e244a4 100644 --- a/hex.js +++ b/hex.js @@ -89,7 +89,7 @@ $$(".xed").forEach($xed => { .map(c => String.fromCodePoint(c + (0x20 <= c && c < 0x7F ? 0 : 0xF000))) .join('').replace(/(.{16})(?=.)/g, '$1\n'); - $size.textContent = 'size=' + len; + $size.textContent = 'len=' + len; const newpos = pos > 0 && [' ', '\n'].includes($hex.value[pos - 1]) ? pos - 1 : pos; $hex.setSelectionRange(newpos, newpos); diff --git a/index.html b/index.html index 7034ee5..d6e1a89 100644 --- a/index.html +++ b/index.html @@ -134,6 +134,11 @@