Encrypt and decrypt text using classical ciphers like Caesar or Vigenère.
Classical ciphers like the Caesar and Vigenère cipher paved the way for modern cryptography. They are known as Substitution Ciphers because they substitute one letter for another based on a specific algorithmic mapping.
Used by Julius Caesar to send military messages, this cipher simply shifts every letter in the alphabet by a fixed number. If the shift is 3, 'A' becomes 'D', 'B' becomes 'E', and so on.
Because there are only 25 possible shifts in the English alphabet, this cipher offers zero real security and can be broken in milliseconds using a brute-force attack.
Even if a substitution cipher uses a completely random mapping (e.g. 'A' maps to 'Q', 'B' maps to 'X'), it is still inherently insecure.
In the English language, the letter 'E' appears about 12.7% of the time, while 'T' appears 9%. By analyzing a large block of ciphertext and counting the frequency of the letters, cryptanalysts can quickly deduce the mapping. This technique, known as Frequency Analysis, rendered simple substitution ciphers obsolete by the 9th century.
To defeat frequency analysis, the Vigenère cipher uses a repeating keyword to apply different Caesar shifts to different letters. It is a Polyalphabetic Substitution Cipher.
While considered "unbreakable" for 300 years, it was eventually broken using the Kasiski examination, which mathematically determines the length of the keyword by looking for repeated sequences in the ciphertext.
Why is a monoalphabetic substitution cipher (like assigning a random distinct letter to every letter in the alphabet) insecure?