0% found this document useful (0 votes)
105 views

Lecture-1, Introduction To Cryptography & Classical Ciphers

1. Cryptography is the study of secure communication techniques that allow parties to communicate securely over insecure channels through encryption. 2. This document introduces classical ciphers including substitution and transposition ciphers. Substitution ciphers work by substituting each plaintext symbol with another symbol, while transposition ciphers change the order of symbols but keep the symbols the same. 3. Shift ciphers are introduced as a simple type of substitution cipher where each symbol is shifted by a fixed number, known as the key. Decryption involves shifting symbols in the opposite direction by the same key.

Uploaded by

HARSHIT KHANNA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

Lecture-1, Introduction To Cryptography & Classical Ciphers

1. Cryptography is the study of secure communication techniques that allow parties to communicate securely over insecure channels through encryption. 2. This document introduces classical ciphers including substitution and transposition ciphers. Substitution ciphers work by substituting each plaintext symbol with another symbol, while transposition ciphers change the order of symbols but keep the symbols the same. 3. Shift ciphers are introduced as a simple type of substitution cipher where each symbol is shifted by a fixed number, known as the key. Decryption involves shifting symbols in the opposite direction by the same key.

Uploaded by

HARSHIT KHANNA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Lecture-1

Introduction to Cryptography and Classical Ciphers


2
Chapter 1

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.

1.2 Security Services of Cryptography


The main goal of cryptography is to provide the following four fundamental
information security services.
• Confidentiality: Confidentiality is the fundamental security service
provided by cryptography. Confidentiality means protecting informa-
tion from unauthorized users. It provides a surety to a user that his

3
4 CHAPTER 1.

information is not to be shared with anyone. It is sometimes referred


to as privacy or secrecy.

• Data Integrity: It deals with identifying any alteration to the data.


The data may get modified by an unauthorized entity intentionally or
accidentally. Data integrity cannot prevent the alteration of data, but
provides a means for detecting whether data has been manipulated.

• Authentication: Authentication provides the identification of the


originator. It confirms to the receiver that the data received has been
sent only by an identified and verified sender. Apart from the origina-
tor, authentication may also provide assurance about other parameters
related to data such as the date and time of creation/transmission.

• Non-repudiation: It ensures that an entity cannot refuse the own-


ership of a previous commitment or an action. Non-repudiation is a
property that is most desirable in situations where there are chances of
a dispute over the exchange of data.

1.3 Basic Terminology:

Figure 1.1: Block-diagram

• Plaintext (P): It is the message to be protected during transmission.


1.3. BASIC TERMINOLOGY: 5

• Ciphertext (C): It is the scrambled version of the plaintext produced


by the encryption.

• Encryption (E): It is a process of converting plain text to cipher text


i.e.

E :P 7→ C
m 7→ E(m) = c

• Decryption (D): It is a process of reconverting cipher text to plain


text i.e.

D :C 7→ P
c 7→ D(c) = m

• Encryption Key: It is a value that is known to the sender and used


for encryption.

• Decryption Key: It is a value that is known to the receiver and used


for decryption.

• Cryptanalysis: It is the study of deciphering ciphertext without


knowing key.

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.

Let Plain text space is P = {A, B, . . . , Z} and Cipher text space is


C = {A, B, . . . , Z}.
Then Encryption function is defined by

E :P→C
And Decryption function is defined by

D:C→P

Such that
DE = ED = I

E0 : A B C ... X Y Z (No shift)


E1 : B C D ... Y Z A (Shift by 1)
E2 : C D E ... Z A B (Shift by 2)
E3 : D E F ... A B C (Shift by 3)

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”

D1 (RK)=QJ (make no sense i.e no english word )

D2 (RK)=PI (possibility of english words like PIN,PING etc)

D2 (LZL)=JXJ

Combining two decryptions we have “PI JXJ” (make no sense i.e no en-
glish word )

D3 (RK)=OH (make sense)


1.3. BASIC TERMINOLOGY: 7

D3 (LZL)=IWI (make sense i.e OH I WI)

D3 (VKL)=SHI (make sense i.e OH I WISH I)

D3 (NQHZ)=KNOW (make sense)

So Cipher text is decrypted by D3 and decrypted message is “OH! I WISH I


KNOW”.

Numerical equivalent of Symbols (Alphabets, other text symbols):-


To perform mathematical operations on plain texts and cipher texts we need
some numeric value corresponding to alphabets.

• Monograph: Monograph means single symbol at a time for encryp-


tion and decryption.
Numerical equivalent of monographs (Single symbol):

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

i.e {A,B,. . . ,Y,Z,?,!,. . . b̂}={0,1,. . . ,24,25,. . . ,n-1} for n symbols and


mathematical operations are same as Zn with addition and multiplica-
tion modulo n(=no of symbols).

• Digraphs: Digraphs means two symbols at a time for encryption and


decryption. There is two ways for numerical equivalent of digraphs:
8 CHAPTER 1.

1. Numerical equivalent of symbols are as follows:

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

Numerical equivalent of digraph XY is equal to


XY= Numerical equivalent of X.Numerical equivalent of Y (each
having two digits).
e.g. NO=1314, AN=0013, NI=1308 O!=1427 etc.

2. Numerical equivalent of digraphs XY to base n can be written as

XY = n × N (X) + N (Y )

N(X)= Numerical equivalent to X


N(Y)= Numerical equivalent to Y

E.g. AN=0 × n + 13
NO=13 × n + 14
O!= 14 × n + 27

In particular, let english alphabets be set of symbols (n=26) then


we have
AN=A×26+N=0 × 26 + 13
NO=13 × 26 + 14
NI= 13 × 26 + 8

• Similarly for trigraphs (3 alphabets at a time for encryption and de-


cryption)

XY Z = n2 × N (X) + n × N (Y ) + N (Z)
1.4. CLASSICAL CIPHER: 9

Remark: In general, we can label blocks of k letters in an N -letter alphabet


by integers between 0 and N k − 1 by regarding each such block as a k-digit
integer to the base N .

Assumption(Kirchoff ’s law):- The attacker knows all the details(of the


cryptosystem) except the keys (excepts) the cryptosystem is still secure.
No cryptosystem is secure only time matters.

1.4 Classical Cipher:


Classical ciphers are ciphers that were used upto 1970s that is in the pre
computer era. But since then thay have fallen out of use. This is due to the
fact that most of them can be solved by hand or using modern cryptographic
algorithms.
There are two type of classical ciphers.

Substitution Cipher: In substitution ciphers each symbol of the plaintext


message is substituted by other symbol in a systematic form. Substitution
of symbols can be done mono alphabetically or poly alphabetically.

Transposition cipher: In transposition cipher symbols of the plaintext


message remain same but ordering of these symbols are changed in a specific
form.

1.5 Substitution Ciphers


1.5.1 Shift Cipher:
Suppose we are using an n-letter symbols(alphabets) with numerical equiva-
lents 0, 1, ..., n − 1, i.e. |P| = n. Let b be a fixed integer with 0 ≤ b ≤ n − 1.
In shift cipher we do encryption by shift transformation.

• Encryption: The encryption function is defined by

E: P → C
m 7→ c = E(m) ≡ m + b (mod n)
10 CHAPTER 1.

Figure 1.2: Cyclic Shift by 5 latter

where ‘m0 is numerical equivalent of symbol (alphabet) to be encrypted.

• Decryption: The decryption function is defined by


D: C → P
c 7→ m = D(c) ≡ c − b (mod n)

Note1: Here, P and C are equivalent to Zn .

Note2: In particular, when b = 3 shift cipher is known as Caesar cipher.

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”

E(m1 = H) = E(7) = 7 + 2 ≡ 9 (mod 26) = J


E(m2 = E) = E(4) = 4 + 2 ≡ 6 (mod 26) = G
E(m3 = L) = E(11) = 11 + 2 ≡ 13 (mod 26) = N
E(m4 = L) = E(11) = 11 + 2 ≡ 13 (mod 26) = N
E(m5 = O) = E(14) = 14 + 2 ≡ 16 (mod 26) = Q

So encryption of ’HELLO’ is ’JGNNQ’.

Decryption: Decryption function is given by

D : Z26 → Z26
c 7→ m = D(c) ≡ c − 2 (mod 26)

To decrypt “JGNNQ”

D(C1 = J) = D(9) = 9 − 2 ≡ 7 (mod 26) = H


D(C2 = G) = D(6) = 6 − 2 ≡ 4 (mod 26) = E
D(C3 = N ) = D(13) = 13 − 2 ≡ 11 (mod 26) = L
D(C4 = N ) = D(13) = 13 − 2 ≡ 11 (mod 26) = L
D(C5 = Q) = D(16) = 16 − 2 ≡ 14 (mod 26) = O

So decryption of ’JGNNQ’ is ’HELLO’.

1.5.2 Hill Cipher:


Let P and C be a plain text space and cipher text space on Zn .

• Encryption: The encryption function is defined by

E :Zn → Zn
m 7→ E(m) = c ≡ am (mod n)

where a ∈ Zn is a fixed integer.


12 CHAPTER 1.

• Decryption: The decryption function is defined by

D :Zn → Zn
c 7→ D(c) ≡ a−1 c (mod n)

(Provided a−1 exist) it exist when (a, n) = 1 and can be computed by


Euclidean algorithm.

Example:
Let P = {A, B, . . . , Z, } and n = 26
Plain text- “SPARKY”

Encryption: Let a = 3

E(m) = c ≡ 3m (mod 26)

E(S) = E(18) ≡ 3 · 18 (mod 26) = 2 = C


E(P ) = E(15) ≡ 3 · 15 (mod 26) = 9 = J
E(A) = E(0) ≡ 3 · 0 (mod 26) = 0 = A
E(R) = E(17) ≡ 3 · 17 (mod 26) = 25 = Z
E(K) = E(10) ≡ 3 · 10 (mod 26) = 4 = E
E(Y ) = E(24) ≡ 3 · 24 (mod 26) = 20 = U

Encrypted message is “CJAZEU”

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

i.e 3−1 ≡ 9 (mod 26)

D(C) = D(2) ≡ 9 · 2 (mod 26) = 18 = S


D(J) = D(9) ≡ 9 · 9 (mod 26) = 15 = P
D(A) = D(0) ≡ 9 · 0 (mod 26) = 0 = A
D(Z) = D(25) ≡ 9 · 25 (mod 26) = 17 = R
D(E) = D(4) ≡ 9 · 4 (mod 26) = 10 = K
D(U ) = D(20) ≡ 9 · 20 (mod 26) = 24 = Y

Decrypted message is “SPARKY”

1.5.3 Affine Cipher: (Shift as well as multiplication)


Let P and C be a plain text space and cipher text space on Zn .

• Encryption: The encryption function is defined by

E :Zn → Zn
m 7→ E(m) = c ≡ am + b (mod n)

where a, b ∈ Zn are fixed integer.

• Decryption: The decryption function is defined by

D :Zn → Zn
c 7→ D(c) ≡ a0 c + b0 (mod n)

where a0 ≡ a−1 (mod n) and b0 ≡ −a−1 b (mod n) (Provided a−1 exist)

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.

Encryption: Let a = 13, b = 9

E(m) = c ≡ 13m + 7 (mod 27)

E(H) = E(7) ≡ 13 · 7 + 7 (mod 27) = 17 = R


E(E) = E(4) ≡ 13 · 4 + 7 (mod 27) = 5 = F
E(L) = E(11) ≡ 13 · 11 + 7 (mod 27) = 15 = P
E(P ) = E(15) ≡ 13 · 15 + 7 (mod 27) = 13 = N
E( ) = E(26) ≡ 13 · 26 + 7 (mod 27) = 21 = V
¯
E(M ) = E(12) ≡ 13 · 12 + 7 (mod 27) = 1 = B

Encrypted message is “RFPNVBF”

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)

D(R) = D(17) ≡ 25 · 17 + 14 (mod 27) = 7 = H


D(F ) = D(5) ≡ 25 · 5 + 14 (mod 27) = 4 = E
D(P ) = D(15) ≡ 25 · 15 + 14 (mod 27) = 11 = L
D(N ) = D(13) ≡ 25 · 13 + 14 (mod 27) = 15 = p
D(V ) = D(21) ≡ 25 · 21 + 14 (mod 27) = 26 =
¯
D(B) = D(1) ≡ 25 · 1 + 14 (mod 27) = 12 = M

Decrypted message is “HELP ME”

Activity: Read a 500 words article in English. Count how many times
each English alphabet letter appears in that article.

You might also like