Beaufort Cipher

Introduction §

The Beaufort cipher, created by Sir Francis Beaufort, is a polyalphabetic substitution cipher that is similar to the Vigenère cipher, except that it enciphers characters in a slightly different manner.

The Algorithm §

The 'key' for a beaufort cipher is a key word. e.g. 'FORTIFICATION'

The beaufort cipher uses the following tableau (the 'tabula recta') to encipher the plaintext:

 
    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
    ---------------------------------------------------
A   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
B   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 A
C   C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D   D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E   E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F   F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G   G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H   H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I   I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J   J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K   K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L   L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M   M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N   N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O   O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P   P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q   Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R   R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S   S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T   T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U   U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V   V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W   W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X   X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y   Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z   Z 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

To encipher a message, repeat the keyword above the plaintext:

FORTIFICATIONFORTIFICATIONFO
DEFENDTHEEASTWALLOFTHECASTLE

(The following assumes we are enciphering the plaintext letter D with the key letter F) Now we take the letter we will be encoding, and find the column on the tableau, in this case the 'D' column. Then, we move down the 'D' column of the tableau until we come to the key letter, in this case 'F' (The 'F' is the keyword letter for the first 'D'). Our ciphertext character is then read from the far left of the row our key character was in, i.e. with 'D' plaintext and 'F' key, our ciphertext character is 'C'.

So, the ciphertext for the above plaintext is:

FORTIFICATIONFORTIFICATIONFO
DEFENDTHEEASTWALLOFTHECASTLE
CKMPVCPVWPIWUJOGIUAPVWRIWUUK

Deciphering is performed in an identical fashion, i.e. encryption and decryption using the beaufort cipher uses exactly the same algorithm.

This process can be compared to the Vigenère cipher, which uses a different algorithm, but the same tableau, for finding the ciphertext characters.

Javascript Example §

The following javascript implements the Beaufort cipher.


Plaintext

keyword =

Ciphertext

Other Implementations §

To encipher your own messages in python, you can use the pycipher module. To install it, use pip install pycipher. To encipher messages with the Beaufort cipher (or another cipher, see here for documentation):

>>>from pycipher import Beaufort
>>>Beaufort('HELLO').encipher('defend the east wall of the castle')
'EAGHBELEHKHMSPOWTXGVAAJLWOTH'
>>>Beaufort('HELLO').decipher('EAGHBELEHKHMSPOWTXGVAAJLWOTH')
'DEFENDTHEEASTWALLOFTHECASTLE'

References §

  • [1] Wikipedia has a good description of the encryption/decryption process, history and cryptanalysis of this algorithm
  • Kahn, D (1973) The CodeBreakers. Macmillan: New York
  • Singh, Simon (2000). The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography. ISBN 0-385-49532-3.
comments powered by Disqus

Further reading

We recommend these books if you're interested in finding out more.

Cover of Elementary Cryptanalysis: A Mathematical Approach Elementary Cryptanalysis: A Mathematical Approach ASIN/ISBN: 978-0883856475 Buy from Amazon.com
Cover of The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography ASIN/ISBN: 978-1857028799 Simon Singh's 'The Code Book' is an excellent introduction to ciphers and codes Buy from Amazon.com
Cover of The Codebreakers - The Story of Secret Writing The Codebreakers - The Story of Secret Writing ASIN/ISBN: 0-684-83130-9 Buy from Amazon.com
Y NGP'I ZPGO AVCE GE LGM AVCE VJ OSCC VJ Y JAGMCN CYZS; VPN Y CYZS CSJJ IAVP AVCE GE LGM AVCE VJ OSCC VJ LGM NSJSUDS - Q.U.U. IGCZYSP. (IAS ESCCGOJAYK GE IAS UYPH)