nerdletter/cipher/instructions.md
Gregory Gauthier 135cf1ff01 feat(cipher): add manual OTP decryption instructions and pad generator
- Expand instructions.md with step-by-step manual encryption/decryption example using modular addition.
- Add padgen.py script to generate random one-time pads from /dev/urandom, formatted in groups.
- Add cleanup of temporary audio file in numbers_station.sh.
- Minor title update in site/index.html for clarity.
2026-04-28 17:20:40 +01:00

59 lines
1.9 KiB
Markdown

### HOW TO DECRYPT — STEP BY STEP (by hand)
1. **Key Generation**
- You generate a **truly random key** that is **exactly as long as the plaintext message**.
- The key must be purely random (each bit or character has equal probability and no patterns).
- The key is shared securely between sender and receiver **in advance** (this is the hard part in practice).
2. **Encryption**
- Take the plaintext message.
- Combine it with the key using a reversible operation. The two most common methods are:
- **Bitwise XOR** (for binary data — the standard modern way)
- **Modular addition** (for letters, e.g., A=0, B=1, ..., Z=25 — the classic "pad" method)
**Example with letters (Vigenère-style addition mod 26):**
Plaintext: `H E L L O`
→ Numbers: `7 4 11 11 14`
One-time pad: `X M C K L`
→ Numbers: `23 12 2 10 11`
Ciphertext: `(7+23) (4+12) (11+2) (11+10) (14+11) mod 26`
`4 16 13 21 25`
→ Letters: `E Q N V Z`
3. **Decryption**
- The receiver does the **inverse operation** with the same key.
- For modular addition: subtract the key (mod 26).
- For XOR: XOR the ciphertext with the key again (XOR is its own inverse).
Ciphertext: `E Q N V Z`
Key: `X M C K L`
Plaintext: `H E L L O`
### HOW TO DECRYPT — STEP BY STEP (using your 8-bit machine)
1. Type in the NERDLETTER DECRYPTOR BASIC program (provided with your subscription)
2. RUN
3. When it asks, type the PAD groups from the appropriate page:
`VLGKU` then `JXCYH` then `LYMDC` then `ETLUB`
4. Then type the CIPHERTEXT groups:
`HLXIB` then `JACJP` then `ERXHN` then `EFM`
5. The machine will instantly print the plaintext!
#### RESULT YOU SHOULD SEE:
```
MARYHADALITTLELAMB
```
(Add spaces by hand: “Mary had a little lamb”)
This is perfect secrecy — no computer on Earth can read it without this exact Day Book page.