Alberti Cipher
Nerd Cafe
Last updated
Nerd Cafe
Last updated
The Alberti Cipher is one of the earliest polyalphabetic ciphers, invented by Leon Battista Alberti in the 15th century. It uses two concentric disks to encrypt and decrypt messages.
Here’s a step-by-step explanation with a practical example.
Two Disks:
Outer Disk: Contains uppercase letters (A-Z) and possibly numbers or symbols.
Inner Disk: Contains lowercase letters (a-z) and possibly numbers or symbols.
The inner disk rotates independently of the outer disk.
Key:
The initial alignment of the disks (e.g., Outer Disk 'A' matches Inner Disk 'a') is the starting key.
The cipher can also periodically change alignment during encryption to increase complexity.
Align the Disks:
Decide the initial key (e.g., Outer Disk 'A' aligns with Inner Disk 'm').
Substitute Letters:
For each letter in the plaintext, find it on the outer disk and replace it with the corresponding letter from the inner disk.
Change the Alignment (Optional):
Periodically rotate the inner disk to a new position, as agreed upon in the cipher key, for added security.
Align the Disks:
Use the same initial key and alignment used during encryption.
Reverse Substitution:
For each letter in the ciphertext, find it on the inner disk and replace it with the corresponding letter from the outer disk.
Adjust for Changes:
If the alignment was changed during encryption, synchronize the same changes during decryption.
Scenario: Encrypt the plaintext message: HELLO
.
Outer Disk: A-Z (uppercase)
Inner Disk: a-z (lowercase)
Initial Key: Outer Disk 'A
' aligns with Inner Disk 'm
'.
Step 1: Align the Disks: Outer 'A' aligns with Inner 'm'.
H
→ Find 'H
' on the Outer Disk. It's aligned with 't
' on the Inner Disk.
E
→ Find 'E
' on the Outer Disk. It's aligned with 'q
'.
L
→ Find 'L
' on the Outer Disk. It's aligned with 'x
'.
L
→ Same as above, aligns with 'x
'.
O
→ Find 'O
' on the Outer Disk. It's aligned with 'a
'.
Ciphertext: tqxxa
.
Step 1: Align the Disks: Use the same initial key: Outer 'A
' aligns with Inner 'm
'.
Step 2: Decrypt Each Letter:
t
→ Find 't
' on the Inner Disk. It's aligned with 'H
' on the Outer Disk.
q
→ Find 'q
' on the Inner Disk. It's aligned with 'E
'.
x
→ Find 'x
' on the Inner Disk. It's aligned with 'L
'.
x
→ Same as above, aligns with 'L
'.
a
→ Find 'a
' on the Inner Disk. It's aligned with 'O
'.
Decrypted Text: HELLO
.
To make the cipher more secure:
Periodically rotate the inner disk after encrypting certain letters.
Use symbols or numbers in the disks for added complexity.
The Python code implements the Alberti Cipher with functions for encryption and decryption.