MODULE 1�
Classical Encryption Techniques: Symmetric cipher model, Substitution techniques, Transposition techniques (Text 1: Chapter 1)
Basic Concepts of Number Theory and Finite Fields: Euclidean algorithm, Modular arithmetic (Text 1: Chapter 3)
Text Books:
code in C”, Wiley Publications, 2nd Edition, ISBN: 9971-51-348-X.
Reference Books:
1. Cryptography and Network Security, Behrouz A. Forouzan, TMH, 2007.
2. Cryptography and Network Security, Atul Kahate, TMH, 2003.
Symmetric Cipher Model
Basic Terminology
Symmetric Cipher Model
5
Wednesday, September 22, 2021
Model of Conventional Cryptosystem
Requirements
Y = EK(X)
X = DK(Y)
Cryptography
Types of Cryptanalytic Attacks
Brute Force Search
Classical Substitution Ciphers
Caesar Cipher
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
Caesar Cipher
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
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
a b c d e f g h i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
C = E(p) = (p + k) mod (26)
p = D(C) = (C – k) mod (26)
Cryptanalysis of Caesar Cipher
14
Wednesday, September 22, 2021
Three important characteristics of this problem enabled us to use a brute-force cryptanalysis:
Monoalphabetic Cipher
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher Security
Language Redundancy and Cryptanalysis
English Letter Frequencies
Playfair Cipher
Playfair Key Matrix
MONAR
CHYBD
EFGIK
LPQST
UVWXZ
21
Wednesday, September 22, 2021
Playfair Cipher
1. | Repeating plaintext letters that are in the same pair are separated with a filler letter, such 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). |
Security of the Playfair Cipher
23
Wednesday, September 22, 2021
Hill Cipher
c1 = (k11P1 + k12P2 + k13P3) mod 26
c2 = (k21P1 + k22P2 + k23P3) mod 26
c3 = (k31P1 + k32P2 + k33P3) mod 26
This can be expressed in term of column vectors and matrices:
HILL CIPHER
Encryption
C = K.P (mod 26)
Decryption
P = K-1.C (mod 26)
K-1 = adjoint of K
determinant of K
Polyalphabetic Ciphers (Vigenère cipher)
26
Wednesday, September 22, 2021
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
key: deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
AT&T engineer named Gilbert Vernam in 1918
27
Wednesday, September 22, 2021
One-Time Pad Army Signal Corp officer, Joseph Mauborgne
In theory, we need look no further for a cipher. The one-time pad offers complete security but, in practice, has two fundamental difficulties:
2) Even more daunting is the problem of key distribution and protection. For every message to be sent, a key of equal length is needed by both sender and receiver. Thus, a mammoth key distribution problem exists.
Because of these difficulties, the one-time pad is of limited utility, and is useful primarily for low-bandwidth channels requiring very high security.
Transposition Ciphers
Rail Fence cipher
m e m a t r h t g p r y
e t e f e t e o a a t
MEMATRHTGPRYETEFETEOAAT
Row Transposition Ciphers
Key: 3 4 2 1 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Product Ciphers
Rotor Machines
Steganography
Basic Concepts in Number Theory and Finite Fields
Introduction
Divisors
Properties of Divisibility
for arbitrary integers m and n
e.g. b = 7; g = 14; h = 63; m = 3; n = 2
7|14 and 7|63 hence 7 | 42+126 = 168
Division Algorithm
Greatest Common Divisor (GCD)
Example GCD(1970,1066)
1970 = 1 x 1066 + 904 gcd(1066, 904)
1066 = 1 x 904 + 162 gcd(904, 162)
904 = 5 x 162 + 94 gcd(162, 94)
162 = 1 x 94 + 68 gcd(94, 68)
94 = 1 x 68 + 26 gcd(68, 26)
68 = 2 x 26 + 16 gcd(26, 16)
26 = 1 x 16 + 10 gcd(16, 10)
16 = 1 x 10 + 6 gcd(10, 6)
10 = 1 x 6 + 4 gcd(6, 4)
6 = 1 x 4 + 2 gcd(4, 2)
4 = 2 x 2 + 0 gcd(2, 0)
GCD(1160718174, 316258250)
Dividend Divisor Quotient Remainder
a = 1160718174 b = 316258250 q1 = 3 r1 = 211943424
b = 316258250 r1 = 211943424 q2 = 1 r2 = 104314826
r1 = 211943424 r2 = 104314826 q3 = 2 r3 = 3313772
r2 = 104314826 r3 = 3313772 q4 = 31 r4 = 1587894
r3 = 3313772 r4 = 1587894 q5 = 2 r5 = 137984
r4 = 1587894 r5 = 137984 q6 = 11 r6 = 70070
r5 = 137984 r6 = 70070 q7 = 1 r7 = 67914
r6 = 70070 r7 = 67914 q8 = 1 r8 = 2156
r7 = 67914 r8 = 2156 q9 = 31 r9 = 1078
r8 = 2156 r9 = 1078 q10 = 2 r10 = 0
Modular Arithmetic
so 100 is congruent to 34 mod 11
Modular Arithmetic Operations
Zn = {0, 1, . . . , (n – 1)}
Modular Arithmetic Operations
e.g.
[(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2 (11 + 15) mod 8 = 26 mod 8 = 2
[(11 mod 8) – (15 mod 8)] mod 8 = –4 mod 8 = 4 (11 – 15) mod 8 = –4 mod 8 = 4
[(11 mod 8) x (15 mod 8)] mod 8 = 21 mod 8 = 5 (11 x 15) mod 8 = 165 mod 8 = 5
Modulo 8 Addition Example
+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 |
2 | 2 | 3 | 4 | 5 | 6 | 7 | 0 | 1 |
3 | 3 | 4 | 5 | 6 | 7 | 0 | 1 | 2 |
4 | 4 | 5 | 6 | 7 | 0 | 1 | 2 | 3 |
5 | 5 | 6 | 7 | 0 | 1 | 2 | 3 | 4 |
6 | 6 | 7 | 0 | 1 | 2 | 3 | 4 | 5 |
7 | 7 | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
Modulo 8 Multiplication
+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
2 | 0 | 2 | 4 | 6 | 0 | 2 | 4 | 6 |
3 | 0 | 3 | 6 | 1 | 4 | 7 | 2 | 5 |
4 | 0 | 4 | 0 | 4 | 0 | 4 | 0 | 4 |
5 | 0 | 5 | 2 | 7 | 4 | 1 | 6 | 3 |
6 | 0 | 6 | 4 | 2 | 0 | 6 | 4 | 2 |
7 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
Modular Arithmetic Properties
Euclidean Algorithm
Euclid(a,b)
if (b=0) then return a;
else return Euclid(b, a mod b);
Extended Euclidean Algorithm
ax + by = d = gcd(a, b)
r = ax + by
Finding Inverses
EXTENDED EUCLID(m, b)
1. (A1, A2, A3)=(1, 0, m);
(B1, B2, B3)=(0, 1, b)
2. if B3 = 0
return A3 = gcd(m, b); no inverse
3. if B3 = 1
return B3 = gcd(m, b); B2 = b–1 mod m
4. Q = A3 div B3
5. (T1, T2, T3)=(A1 – Q B1, A2 – Q B2, A3 – Q B3)
6. (A1, A2, A3)=(B1, B2, B3)
7. (B1, B2, B3)=(T1, T2, T3)
8. goto 2
Inverse of 550 in GF(1759)
Q | A1 | A2 | A3 | B1 | B2 | B3 |
— | 1 | 0 | 1759 | 0 | 1 | 550 |
3 | 0 | 1 | 550 | 1 | –3 | 109 |
5 | 1 | –3 | 109 | –5 | 16 | 5 |
21 | –5 | 16 | 5 | 106 | –339 | 4 |
1 | 106 | –339 | 4 | –111 | 355 | 1 |
355 is inverse of 550