Shift English letters by 0-25 to demonstrate the Caesar cipher, for teaching classical substitution ciphers.
仅演示字母位置计算,不含完整加解密。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Encryption | C = (P + k) mod 26 with P the plaintext letter index and k the shift | Suetonius, De Vita Caesarum, Life of Julius Caesar §56 |
| Decryption | P = (C − k + 26) mod 26, keeping the result within 0 to 25 | Kahn, The Codebreakers, 1967 — classical substitution ciphers |
| Effective key space | Only 25 shifts from 1 to 25 are meaningful; k = 0 and k = 26 leave text unchanged | Kahn, The Codebreakers, 1967 — frequency analysis |