Classical Ciphers
An Interactive Introduction to Cryptography
Caesar Cipher
How It Works
The Caesar Cipher is a simple substitution cipher. You pick a secret number (the "key"), and every letter in your message is shifted forward that many places in the alphabet. If you go past 'Z', you just wrap around back to 'A'.
Example (Key = 3)
Plaintext: HELLO
Becomes...
Ciphertext: KHOOR
History
Named after Julius Caesar, who, according to Suetonius, used it with a shift of three to protect military communications. While rudimentary, it was effective against enemies who couldn't read or assumed the messages were in a foreign language.
Pros & Cons
Pros: Very easy to understand and use, requires only a small piece of shared information (the key).
Cons: Extremely insecure. With only 25 meaningful keys, it can be broken in minutes by a "brute-force" attack (trying every key).
Atbash Cipher
How It Works
The Atbash Cipher is even simpler than the Caesar cipher because it doesn't need a key! It works by reversing the alphabet. 'A' becomes 'Z', 'B' becomes 'Y', 'C' becomes 'X', and so on.
Example
Plaintext: WIZARD
Becomes...
Ciphertext: DRAZIW
History
This is one of the earliest known substitution ciphers, with origins in ancient Hebrew. It was used in the biblical Book of Jeremiah. The name "Atbash" comes from the first and last letters of the Hebrew alphabet (Aleph and Tav) and the second and second-to-last (Bet and Shin).
Pros & Cons
Pros: No key needs to be exchanged, making it very simple to use.
Cons: The method is fixed and widely known. Once an adversary suspects Atbash, the message can be decrypted instantly.
Since it's a simple reversal, encryption and decryption are the same process!
Keyword Cipher
How It Works
This cipher uses a secret word (the "keyword") to scramble the alphabet. First, you remove duplicate letters from your keyword. Then, you write the unique letters of the keyword at the beginning of the alphabet, followed by all the other letters in order.
Example (Keyword: CRYPTO)
Plain Alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher Alphabet: C R Y P T O A B D E F G H I J K L M N Q S U V W X Z
History
The Keyword Cipher is a classical monoalphabetic substitution cipher. While its exact origins are unclear, it was a natural step up from the Caesar cipher and was used both by hobbyists and in some military contexts before more advanced polyalphabetic ciphers became common.
Pros & Cons
Pros: Much stronger than the Caesar cipher, with thousands of possible keys. It's not vulnerable to simple brute-force attacks.
Cons: It is still vulnerable to frequency analysis. Since 'E' is the most common letter in English, whatever letter 'E' is mapped to will likely be the most common in the ciphertext.
Pigpen Cipher
How It Works
The Pigpen cipher is a visual cipher that swaps letters for symbols. The symbols are derived from the fragments of a grid where the letters are placed.
History
Also known as the Masonic Cipher, it was famously used by the Freemasons in the 18th century to keep their records private. Variations were also used by Rosicrucianists and even prisoners during the American Civil War.
Pros & Cons
Pros: Looks cryptic and is unreadable to anyone unfamiliar with the method. It's fun and visually interesting.
Cons: Like Atbash, it's a fixed system with no key. Once the grid is known, any message can be deciphered. It's just security through obscurity.

Vigenère Cipher
How It Works
A huge leap in complexity! The Vigenère cipher uses a keyword to apply a series of different Caesar ciphers. Each letter of the keyword determines the shift amount for the corresponding letter in the message. This makes it immune to simple frequency analysis.
Example (Keyword: LEMON)
Plaintext: A T T A C K A T D A W N
Keyword: L E M O N L E M O N L E
Ciphertext: L X F O P V E F R N H R
History
Though conceived earlier by Giovan Battista Bellaso, it was misattributed to French diplomat Blaise de Vigenère in the 19th century. For over 300 years, it was famously known as "le chiffrage indéchiffrable" (the indecipherable cipher). It was only definitively broken in the mid-19th century by Charles Babbage and later, Friedrich Kasiski.
Pros & Cons
Pros: As a polyalphabetic cipher, it defeats simple frequency analysis. It's significantly more secure than any of the ciphers that came before it.
Cons: Vulnerable to the Kasiski examination, a method that can deduce the length of the keyword, reducing the problem to breaking several Caesar ciphers.

Thanks for Exploring!
I hope you enjoyed this introduction to classical ciphers.
Check out my other projects!