The idea in plain English: XOR stands for "exclusive OR." Imagine flipping a light switch — but with a rule: the light turns on ONLY when exactly one switch is up (not both). That's XOR. In binary (0s and 1s), XOR outputs 1 when the two inputs are different, and 0 when they're the same. To encrypt text, you take each letter's numeric code and XOR it with a secret key byte. The magic trick: XOR the encrypted result with the same key again, and you get back the original. Same operation encrypts AND decrypts.
Why this really exists: XOR is the foundation of modern block ciphers like AES (Advanced Encryption Standard), which protects your bank transactions, WhatsApp messages, and WiFi passwords. The famous One-Time Pad, the only mathematically unbreakable encryption, is just XOR with a truly random key as long as the message. XOR gates are also a fundamental building block in every computer processor.
Say the key byte is 0x55 (binary: 01010101). Let's encrypt "HELLO":
To decrypt, XOR the ciphertext bytes with the same key (0x55) again: 29 XOR 0x55 = 72 = H. Magic! The original text reappears.
💡 This is why XOR encryption is symmetric — encrypting twice with the same key gives you back the original. That's not true for other operations like AND or OR.
1. Get the ciphertext bytes and the key byte from the puzzle data
2. For each byte, XOR it with the key: plain_byte = cipher_byte ^ key
3. Convert each resulting number to a character (ASCII)
4. Join all characters → the decoded message!
💡 If you don't know the key, try all 256 possible values (0–255). Only one will produce readable text. This brute-force is fast because there are only 256 keys to test.
| A | B | A XOR B | Meaning |
|---|---|---|---|
| 0 | 0 | 0 | Same → off |
| 0 | 1 | 1 | Different → on |
| 1 | 0 | 1 | Different → on |
| 1 | 1 | 0 | Same → off |