You are on page 1of 38

Hill Cipher

• Invented by Lester S. Hill


• Arrange keyword in a n x n matrix
• Group plaintext into diagrams or trigrams and write in column vector
form
• Perform matrix multiplication
• Vectors are then converted back into letters to produce ciphertext
• Encryption: C = KPmod 26
• Decryption: P = CK-1mod26
Example – Hill Cipher
• Plaintext – ACT
• Keyword – GYBNQKURP (n=3)
Example – Hill Cipher
• Plaintext – shortexample
• Keyword – hill (n=2)

C= =

• C=
One time pad (Vernam cipher) - Encryption
One time pad (Vernam cipher) - Decryption
Rotor cipher
Enigma machine
Transposition Ciphers
Transposition Ciphers
• Changes locations of symbols
oKeyless transposition ciphers
oKeyed transposition ciphers
oCombination of above two ciphers
Keyless transposition ciphers
Rail fence technique
• Write down plain text in sequence of diagonals
• Read plaintext as a sequence of rows
• Ex –

• Plaintext – it is bright sunny day


i i b i h s n y a
t s r g t u n d y

Ciphertext - iibihsnyatsrgtundy
Simple columnar technique
1. Write plaintext row by row in rectangle of pre defined size
2. Read message column by column. Column order – random
3. Message obtained – ciphertext
4. Ex –
Plaintext – it is bright sunny day
i t i s b r
i g h t s u
n n y d a y

Column order - 461253


Ciphertext - stdruyiintgnbsaihy
Simple columnar technique with multiple
rounds
1. Write plaintext row by row in rectangle of pre defined size
2. Read message column by column. Column order – random
3. Message obtained – ciphertext of round 1
4. Repeat above steps as desired
Example - Simple columnar technique with multiple
rounds
• Plaintext – it is bright sunny day

• Column order - 461253


• Ciphertext (Round 1) – stdruyiintgnbsaihy
s t d r u y
i i n t g n
b s a i h y

• Column order - 123456


• Ciphertext (Round 2) – sibtisdnartiughyny
Keyed transposition ciphers
• Ex - WE HAVE AN ATTACK
• Block size – 5
• WEHAV EANAT TACKX

Encryption 4 1 3 2 5
Decryption
1 2 3 4 5

• AWHEV AENAT KTCAX


Combination of two approaches
Encryption/decryption keys in transposition
ciphers
Key inversion in transposition cipher
Using matrices in transposition ciphers
Double Transposition ciphers
Stream ciphers
Block ciphers
Mathematics of cryptography
• Set of Integers

• Binary operations
Ex – binary operation
Integer division
• a=q*n+r
Graph of division algorithm
Divisibility
• a = q*n
GCD
• Largest integer that can divide both integers
Euclidean algorithm
• gcd (a, 0) = a
• gcd (a, b) = gcd (b, r), where r – remainder of dividing a by b
Ex – Euclidean algorithm
• Find GCD of 25 and 60.
Extended Euclidean algorithm
s = s1 – q *s2 t = t1 – q*t2
Contd.
Ex – Extended Euclidean Algorithm
• Find gcd (161, 28). Also find s and t.
Ex – Extended Euclidean Algorithm
• Find gcd (17,0). Also find s and t.
Linear Diophantine Equation
• ax + by = c
• d = gcd(a,b)
• Particular solution:
x0 = (c/d)s and y0 = (c/d)t
• General solutions:
• x = x0 + k (b/d) and y = y0 − k(a/d)
where k is an integer
Modular arithmetic
Set of residues

You might also like