Cipher Chapter8
Cipher Chapter8
Plain Text A T T A C K
Cipher Text F Y Y F H P
Example: Encrypt the word Z O O M with the key K E Y using Vignere Cipher
Step 2. Choose a key (In this example the key is K E Y). Since ZOOM is 4 letters the key will
repeat so ( K E Y K )
Step 4. Determine the shifted positions by adding the Positions of the Plain Text letters Plus the
Positions of the Key
Step 5. For Values resulting greater than 26(Mod 26) Subtract it with the Value
Plain Text Z O O M
Position 25 14 14 12
Key K E Y K
Key Position 10 4 24 10
Shifted Position 35 18 38 22
Mod 26 (35-26) 9 18 (38-26) 12 22
Cipher Text J S M W
To decrypt
Step 1. Reverse all the process starting from Plain Text Positions
Step 2. All will be the same except for the Shifted Positions. The current Position will be
subtracted to the key Position
Step 3. For Mod26 Values. Add 26 to those who have negative values
Plain Text J S M W
Position 9 18 12 22
Key K E Y K
Key Position 10 4 24 10
Shifted Position -1 (9 -10) 14 -12(12-24) 12
Mod 26 (-1 +26) 25 14 14 (-12+26) 22
Cipher Text Z 0 0 M
Transposition Cipher
Example: Reverse the Plain Text H E L L O
Plain Text H E L L O
Cipher Text O L L E H
Vernam Cipher
Example: Encrypt the word D O G with the key X K Y using Vernam Cipher
First, we convert each letter in "DOG" to its ASCII Decimal value, then to Binary.
D 68 01000100
O 79 01001111
G 71 01000111
X 88 01011000
K 75 01001011
Y 89 01011001
D 0 1 0 0 0 1 0 0
X 0 1 0 1 1 0 0 0
XOR ⊕ 0 0 0 1 1 1 0 0
= 00011100 (Ciphertext)
O 0 1 0 0 1 1 1 1
K 0 1 0 0 1 0 1 1
XOR ⊕ 0 0 0 0 0 1 0 0
= 00000100 (Ciphertext)
G 0 1 0 0 0 1 1 1
Y 0 1 0 1 1 0 0 1
XOR ⊕ 0 0 0 1 1 1 1 0
= 00011110 (Ciphertext)
Binary 0 0 0 0 0 1 0 0
Convert 𝟐𝟕 𝟐 𝟔
𝟐 𝟓 𝟐 𝟒
𝟐 𝟑
𝟐 𝟐
𝟐 𝟏
𝟐𝟎
Decimal 0 0 0 0 0 4 0 0
=4
Binary 0 0 0 1 1 1 1 0
Convert 𝟐𝟕 𝟐 𝟔
𝟐 𝟓 𝟐 𝟒
𝟐 𝟑
𝟐 𝟐
𝟐 𝟏
𝟐𝟎
Decimal 0 0 0 16 8 4 2 0
= 30
To Decrypt
28 0 0 0 1 1 1 0 0
X 0 1 0 1 1 0 0 0
XOR ⊕ 0 1 0 0 0 1 0 0
= 01000100 is 68 in decimal and is letter D
40 0 0 0 0 0 1 0 0
K 0 1 0 0 1 0 1 1
XOR ⊕ 0 1 0 0 1 1 1 1
=01001111 is 79 in decimal and letter O
30 0 0 0 1 1 1 1 0
Y 0 1 0 1 1 0 0 1
XOR ⊕ 0 1 0 0 0 1 1 1
=01000111 is 71 in decimal and letter G