Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Playfair

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Chapter Two

 Beaufort Cipher
The Beaufort cipher, created by Sir Francis Beaufort, is a substitution cipher that is similar to
the Vigenère cipher, with a slightly modified enciphering mechanism and tableau.
Encryption:
Ci = (ki - pi ) mod 26 ……(11).

Locate the plaintext letter in the top row of the table. Search the column immediately under till the key letter
is found. Follow the row of the key letter to the left. The crypto letter is found in the leftmost column.
Decryption:

pi = (ki - Ci ) mod 26 ……(12).

Locate the crypto letter in the leftmost column of the table. Search the row to the right till the key letter is found.
Go straight up from the key letter. The plaintext is found in the top row. The Beaufort way of using the table is
somewhat easier than standard Vigenère, since you only have to follow one route instead of finding an

intersection of a row and a column.


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
C 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
i
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
p 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
h 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
e
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
r 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
t 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
e 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
x 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 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
Table (2.2): Beaufort Table or Tabula Recta or Beaufort Square
Example: Encrypt the message “defend the east wall of the castle ”, using Beaufort cipher for
the given keyword is fortification.
Ans. : Ciphertext: “CKMPVC PVW PIWU JOGI UA PVW RIWUUK”
Key: k f o r t i f i c a t i o n f o r t
5 14 17 19 8 5 8 2 0 19 8 14 13 5 14 17 19
Plaintext: p d e f e n d t h e e a s t w a l l
3 4 5 4 13 3 19 7 4 4 0 18 19 22 0 11 11
Ciphertext: C 2 10 12 15 21 2 15 21 22 15 8 22 20 9 14 6 8
Ci = (ki - pi ) C K M P V C P V W P I W U J O G I
mod 26

Key: k i f i c a t i o n f o
8 5 8 2 0 19 8 14 13 5 14
Plaintext: p o f t h e c a s t l e
14 5 19 7 4 2 0 18 19 11 4
Ciphertext: C 20 0 15 21 22 17 8 22 20 20 10
Ci = (ki - pi ) mod 26 U A P V W R I W U U K
iii. Vernam Cipher (Stream)
The ultimate defense against such a cryptanalysis is to choose a keyword that is as long as the
plaintext and has no statistical relationship to it. Such a system was introduced by an AT&T
engineer named Gilbert Vernam. His system works on binary data (bits) rather than letters. The
system can be expressed succinctly as follows (Figure 2.3):

Key stream Key stream


generator generator

Cryptographic bit stream (ki ) Cryptographic bit stream (ki )

Plaintext (pi ) Ciphertext (ci ) Plaintext (pi )

Figure (2.3): Vernam Cipher


Encryption:
Where:
Ci = pi ⊕ ki …………(13). pi = i-th binary digit of plaintext
Decryption: ki = ith binary digit of key
Ci = ith binary digit of ciphertext
pi = Ci ⊕ ki …………(14). ⊕ = exclusive-or (XOR) operation
The essence of this technique is the means of construction of the key. Vernam proposed the
use of a running loop of tape that eventually repeated the key, so that in fact the system
worked with a very long but repeating keyword. Although such a scheme, with a long key,
presents formidable cryptanalytic difficulties, it can be broken with sufficient ciphertext, the
use of known or probable plaintext sequences, or both.
Example: Encrypt the message “HELLO”, using the key “PLUTO”.
Ans. : 1. Obtain the binary ASCII character code for each letter of the plaintext
H = 72 E = 69 L = 76 L = 76 O = 79 To represent any decimal number by binary
01001000 01000101 01001100 01001100 01001111 𝟐𝟕 𝟐𝟔 𝟐𝟓 𝟐 𝟒 𝟐𝟑 𝟐𝟐 𝟐𝟏 𝟐𝟎 128 64 32 16 8 4 2 1

2. Obtain the binary ASCII character code for each letter of the key
P = 80 L = 76 U = 85 T = 84 O = 79
01010000 01001100 01010101 01010100 01001111

3. Carry out the XOR operation, applying it to each corresponding pair of bits: Ciphertext is
CAN (cancel) TAB EM CAN (cancel) NUL (null)
(end of Where: each of CAN, TAB, EM, NUL
medium) represent one character
00011000 00001001 00011001 00011000 00000000
iv. One Time Pad
An Army officer, Joseph Mauborgne, proposed an improvement to the Vernam cipher that yields the
ultimate in security. Mauborgne suggested using a random key that is as long as the message, so that the key
need not be repeated. In addition, the key is to be used to encrypt and decrypt a single message, and then is
discarded. Each new message requires a new key of the same length as the new message. Such a scheme,
known as a One-Time Pad (OTP), is unbreakable. It produces random output that bears no statistical
relationship to the plaintext. Because the ciphertext contains no information whatsoever about the plaintext,
there is simply no way to break the code. The OTP cipher has:
1- Key is generated random, as long as the message is used, the cipher will be secure
2- Key Size = Message Size
3- Every message has its key
4- Key is not used more than one time
5- Is unbreakable since ciphertext bears no statistical relationship to the plaintext
6- Problems in generation & safe distribution of key
7- Is the only one with Perfect Security
The one-time pad is of limited utility and is useful primarily for low-bandwidth channels requiring very high
security. The one-time pad is the only cryptosystem that exhibits what is referred to as perfect secrecy.
v- Polygraphic
Polygram substitution ciphers /encipher block of letters at the time, rather than a single letter;
this makes cryptanalysis harder, as it destroys the single letter frequency distribution.
Polygraphic substitution divides the plaintext into groups of letters. Then, they replace each
group of letters by one of the predefined letters, numbers, graphic symbols, or by another
group of characters.
 Playfair cipher
• This cipher was actually invented by British scientist Sir Charles Wheatstone, but it bears the
name of his friend Baron Playfair who championed the cipher at the British foreign office.
• The best-known multiple-letter encryption cipher is the Playfair, which treats digrams in the
plaintext as single units and translates these units into ciphertext digrams.
• The Playfair cipher is a great advance over simple monoalphabetic ciphers. For one thing,
whereas there are only 26 letters, there are 26 × 26 = 676 digrams, so that identification of
individual digrams is more difficult.
• Furthermore, the relative frequencies of individual letters exhibit a much greater range than
that of digrams, making frequency analysis much more difficult. For these reasons, the
Playfair cipher was for a long time considered unbreakable.
• It was used as the standard field system by the British Army in World War I and still enjoyed
considerable use by the U.S. Army and other Allied forces during World War II.
Playfair Algorithm
• The Playfair algorithm is based on the use of a 5 × 5 matrix of letters constructed using a keyword.
• The matrix is constructed by filling in the letters of the keyword from left to right and from top to bottom, but
the repeated letters should be omitted (minus duplicates). For example, use the keyword is monarchy.
• Then filling in the remainder of the matrix with the remaining letters in alphabetic order. M O N A R
• The letters I and J count as one letter (combining I and J in one cell). C H Y B D
• Plaintext is encrypted two letters at a time, according to the following rules: E F G I/J K

1. Repeating plaintext letters that are in the same pair are separated with a filler letter, such L P Q S T
U V W X Z
as x, so that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each replaced by
the letter to the right, with the first element of the row circularly following the last. For example,
ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the letter beneath, with the top element
of the column circularly following the last. For example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and the column
occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM (or JM, as the encipherer wishes).
(Find the h and s in the square and locate the letters at opposite corners of the rectangle they form).
Example: Encrypt the message “instruments”, using Playfair cipher for the given keyword “monarchy”.
Ans. :
Algorithm to encrypt the plain text:
1- Generate the key Square (5×5): The key square is a 5×5 grid of alphabets that acts as the key for encrypting the
plaintext.
2- The plaintext is split into pairs of two letters (digraphs). If there is an odd number of letters, a ‘z’ is added to the
last letter. Plaintext: in st ru me nt sz
Rules for Encryption:
• If the two letters are in the same column: Take the letter below each one (going back to the top if at the
bottom).
• If both the letters are in the same row: Take the letter to the right of each one (going back to the leftmost if at
the rightmost position).
• If neither of the above rules is true: Form a rectangle with the two letters and take the letters on the
horizontal opposite corner of the rectangle. M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Plaintext in st ru me nt sz
Ciphertext GA TL MZ CL RQ TX

Example: Decrypt the ciphertext “GATLMZCLRQTX”, using Playfair cipher for the given keyword “monarchy”.
Ans. : The ciphertext is split into pairs of two letters (digraphs). Note: The ciphertext always have even number of
characters.
Rules for Decryption:
• If both the letters are in the same column: Take the letter above each one (going back to the bottom if at the
top).
• If both the letters are in the same row: Take the letter to the left of each one (going back to the rightmost if at
the leftmost position).
• If neither of the above rules is true: Form a rectangle with the two letters and take the letters on the horizontal
opposite corner of the rectangle.
Example: Encrypt the message “hide the gold in the tree stump”, using Playfair cipher for the given
keyword “playfair example”. (note the null "X" used to separate the repeated "E"s) :
Ans. : the table becomes (omitted letters in red): The Plaintext pairs: hi de th eg ol di nt he tr ex es tu mp

The pair DI forms a rectangle, replace it with BE


The pair NT forms a rectangle, replace it with KU
The pair HE forms a rectangle, replace it with DM
The pair TR forms a rectangle, replace it with UI

The pair ES forms a rectangle, replace it with MO


The pair TU is in a row, replace it with UV
The pair MP forms a rectangle, replace it with IF

Plaintext hi de th eg ol di nt he tr ex es tu mp
Ciphertext BM OD ZB XD NA BE KU DM UI XM MO UV IF

You might also like