XOR CIPHER
XOR cipher, encode and decode alike.
XOR each character with the key; XOR again to recover. A staple in CTF challenges.
Everything runs locally in your browser
What is this?
XOR returns 0 when bits match and 1 when they differ. XORing twice with the same key returns the original, so encryption and decryption are the same step. The key repeats across the whole text.
FAQ
Why is the output garbled?
XOR results are often non-printable bytes. Tick “Show output as hexadecimal” for a clean hex view.
Is anything uploaded?
No. Everything runs in your browser.
示例与注意事项Example & notes
一个例子A worked example
用密钥 key 异或一段文字得到密文,再用同一密钥异或一次即可还原明文。XOR some text with the key "key" to get ciphertext, and XOR it again with the same key to recover the original.
注意事项Things to watch
- 异或加解密对称,密钥泄露等于没加密。XOR is symmetric, so a leaked key means no protection at all.
- 短密钥循环使用会留下明显规律,容易被破解,只适合教学演示。A short repeating key leaves obvious patterns; expect it only for demonstrations.
- 中文要先按 UTF-8 转成字节再运算,直接按字符处理会出错。Chinese text must be converted to UTF-8 bytes first — operating on characters gives wrong results.
相关问答More Q&A
能加密文件吗?Can it encrypt files?
当前处理文本;文件可先转 Base64 再处理,或使用专门的加密工具。Text only for now — convert files to Base64 first, or use a dedicated encryption tool.
密钥要多长?How long should the key be?
越长越好;演示场景建议不短于 8 位,且不要用常见单词。Longer is better: at least eight characters for a demo, and avoid common words.