Lecture-1, Introduction To Cryptography & Classical Ciphers
Lecture-1, Introduction To Cryptography & Classical Ciphers
1.1 Introduction:
In today’s digital age the topmost priority of a human being is to commu-
nicate securely. But it is not easy to have secure communication over any
channel. It has been always a topic of interest ”how to communicate se-
curely”. In past, people used to communicate through handwritten letters,
and letters were sent via hands. It was a tough challenge to maintain the
secrecy of information. For secure communication, they were use riddles,
puzzles, some special characters in place of the original message such a way
that only the receiver could decode.
The practice and study of hiding information is known as Cryptography.
Cryptography is a Mathematical science that comes up with a way for secure
communication between two or more parties by converting the confidential
information into a scrambled form so that only authorized users can remove
scrambles and read information. For instance a sender Alice wants to send
secret information to a receiver Bob over an insecure communication channel
i.e via the internet or telephone. Then it is possible that Eavesdropper can
intercept and read the information.
3
4 CHAPTER 1.
E :P 7→ C
m 7→ E(m) = c
D :C 7→ P
c 7→ D(c) = m
Note:- The plaintext and ciphertext are written in some symbols (usually,
but not always, they are written in the same symbols) consisting of a certain
number n of letters. The term “letter” (or “character” ) can refer not only
to the familiar A-Z, but also to numerals, blanks, punctuation marks, or any
other symbols that we allow ourselves to use when writing the messages.
6 CHAPTER 1.
E :P→C
And Decryption function is defined by
D:C→P
Such that
DE = ED = I
D0 : A B C ... X Y Z
D1 : Z A B ... W X Y
D2 : Y Z A ... V W X
D3 : X Y Z ... U V W
Decrypt “RK!LZLVKLNQRZ”
D2 (LZL)=JXJ
Combining two decryptions we have “PI JXJ” (make no sense i.e no en-
glish word )
A B C D E F G H I J K L M N
0 1 2 3 4 5 6 7 8 9 10 11 12 13
O P Q R S T U V W X Y Z ? !
14 15 16 17 18 19 20 21 22 23 24 25 26 27
A B C D E F G H I J K L M N
00 01 02 03 04 05 06 07 08 09 10 11 12 13
O P Q R S T U V W X Y Z ? !
14 15 16 17 18 19 20 21 22 23 24 25 26 27
XY = n × N (X) + N (Y )
E.g. AN=0 × n + 13
NO=13 × n + 14
O!= 14 × n + 27
XY Z = n2 × N (X) + n × N (Y ) + N (Z)
1.4. CLASSICAL CIPHER: 9
E: P → C
m 7→ c = E(m) ≡ m + b (mod n)
10 CHAPTER 1.
Example:
Let P={A=0,B=1,...,Y=24,Z=25} be set of symbols (alphabets), then en-
cryption function is given by
Encryption: Let b = 2
E : Z26 → Z26
m 7→ c = E(m) ≡ m + 2 (mod 26)
1.5. SUBSTITUTION CIPHERS 11
To encrypt “HELLO”
D : Z26 → Z26
c 7→ m = D(c) ≡ c − 2 (mod 26)
To decrypt “JGNNQ”
E :Zn → Zn
m 7→ E(m) = c ≡ am (mod n)
D :Zn → Zn
c 7→ D(c) ≡ a−1 c (mod n)
Example:
Let P = {A, B, . . . , Z, } and n = 26
Plain text- “SPARKY”
Encryption: Let a = 3
Decryption:
D(c) ≡ 3−1 c (mod 26)
Since (3, 26) = 1, hence 3−1 exist in mod 26. By Euclidean algorithm we can
find inverse of 3 in mod 26.
1.5. SUBSTITUTION CIPHERS 13
E :Zn → Zn
m 7→ E(m) = c ≡ am + b (mod n)
D :Zn → Zn
c 7→ D(c) ≡ a0 c + b0 (mod n)
c − b = am =⇒ a−1 (c − b) = m
=⇒ a−1 c − a−1 b = m
=⇒ a0 c + b0 = m = D(c)
Example:
Let P = {A, B, . . . , Z, } and n = 27
¯
Plain text- “HELP ME”.
14 CHAPTER 1.
Decryption:
D(c) =≡ a0 c + b0 (mod 27)
where a0 ≡ 13−1 (mod 27) and b0 ≡ −13−1 7 (mod 27)
Since (13, 27) = 1, hence 13−1 exist in mod 27. By using Euclidean algorithm
we can find inverse of 13 in mod 27.
Hence a0 ≡ 25 (mod 27) and b0 ≡ −25 · 7 (mod 27) ≡ 14 (mod 27)
Activity: Read a 500 words article in English. Count how many times
each English alphabet letter appears in that article.