Professional Documents
Culture Documents
Basics of Cryptography
- Ciphertext
- Encryption: c = Ee(p)
- Decryption: p = Dd(c)
Kerckhoff’s Principle:
“The secrecy should be in the key used
for decryption, not in the decryption or
encryption algorithms”
Prepared by: Mohan Gholap 2
Types of Cryptography
1. Secret Key Cryptography:
- Both sender and receiver share a common
secret, ie. e = d
- Also called as “Symmetric key Cryptography”
• Types:
Known ciphertext attack
Known plaintext attack
Chosen plaintext attack
Prepared by: Mohan Gholap 5
Brute force attempt to obtain a key from known plaintext
Let (p1,c1), (p2,c2), … (pm,cm) be plaintext-ciphertext pairs
for(each potential key value in key space)
{
proceed = true;
i=1;
while(proceed == true && i <= m) {
if(ci != Ek(pi))
proceed = false;
i++;
}
if(i = m+1)
print (“Key value is k”);
}
Prepared by: Mohan Gholap 6
ELEMENTARY SUBSTITUTION CIPHERS
1. Monoalphabetic ciphers:
- most basic cipher is substitution cipher
- Let ∑ denote set of alphabets, {A,B, … ,Z}
- This approach defines the permutation of elements in ∑
- There are 26! Permutations.
NOTE:
Here, each letter is substituted by another unique
letter, hence such ciphers are called
“monoalphabetic”
Prepared by: Mohan Gholap 8
2. Polyalphabetic Ciphers
• Ciphertext corresponding to a particular
character is not fixed.
i. Vigenere Cipher:
- It uses a multi digit key k1,k2,….,km.
- Plaintext is split into number of blocks, each of
m consecutive characters
- 1st letter of each block replaced by letter k1
positions to its right, 2nd by a letter k2
positions to the right, and so on.
Prepared by: Mohan Gholap 9
Example:
P’text: W i s h i n g Y o u M u c h
Key : 04 19 03 22 07 12 05 11 04 19 03 22 07 12
C’text: A B V D P Y L J S N P Q J T
P’text: S u c c e s s
Key : 05 11 04 19 03 22 07
C’text: X F G V H O Z
In general, c=pK
where, i) c and p are row vectors of ciphertext & plaintext resp’ly,
ii) K is m X m matrix comprising the key
Row 1 ->3, Row 2 -> 5, Row 3 ->2, Row 4 -> 1, Row 5 -> 4.
The resulting matrix is o n a t
r a t I
b e g i
n o o n
n o p e
Prepared by: Mohan Gholap 15
• We now re-arrange the columns as follows,
Column 1->4, Column 2->3, Column 3->1, Column 4 ->2
ATNOTIARGIEBONONPEON
• C’text: 1 1 K C T A T A M M O C P M 5 1 C E N E