You are on page 1of 10

Symmetric Cryptographic Ciphers

(ASSIGNMENT # 1……SEMESTER FALL- 2022)


Submission date (January 25, 2023)

Submitted By:
Amina Tariq (20021519-035)
Submitted To:
Mr. Najeeb Ur Rehman
Course Code (Course Title):
CS-324 (Information Security)
Degree Program Title and Section:
BS-V Computer Science (A)
Department of Computer Science

University of Gujrat

1|P age
Table of Contents

CONTENT PAGE

Contents
1.1.Caesar Cipher………………………………………………….3
1.2.Shift Cipher…………………………………………………….4
1.3.ROT-13 Cipher………………………………………………...5
1.4.Monoalphabetic Cipher……………………………………….6
1.5.Railfence Cipher……………………………………………….6
1.6.Transposition Cipher………………………………………….6
1.7.Vigènere Cipher ……………………………………………….7
1.8.Playfair Cipher……………………………………………...….8
1.9.Hill Cipher……………………………………………….……..9

2|P age
1.1. Caesar Cipher
[Hint: replacing each letter of the alphabet with the letter standing three places
further down the alphabet and likewise for digits]
Plain Text: AMINATARIQ
Key: 3

Encryption
Formula: Y = (X + K) % 26
Plain Text X Y = (X + K) % 26 Y Cipher Text
A 0 (0+3) %26 3 D
M 12 (12+3) %26 15 P
I 8 (8+3) %26 11 L
N 13 (13+3) %26 16 Q
A 0 (0+3) %26 3 D
T 19 (19+3) %26 22 W
A 0 (0+3) %26 3 D
R 17 (17+3) %26 20 U
I 8 (8+3) %26 11 L
Q 16 (16+3) %26 19 T

Encrypted Text: DPLQDWDULT

Decryption
Formula: X = (Y– K) % 26
Cipher Text Y X = (Y - K) % 26 X Plain Text
D 3 (3-3) %26 0 A
P 15 (15-3) %26 12 M
L 11 (11-3) %26 8 I
Q 16 (16-3) %26 13 N
D 3 (3-3) %26 0 A
W 22 (22-3) %26 19 T
D 3 (3-3) %26 0 A
U 20 (20-3) %26 17 R
L 11 (11-3) %26 8 I
T 19 (19-3) %26 16 Q
Decrypted Text: AMINATARIQ

3|P age
1.2. Shift Cipher
[Key is last three digits of your roll number % 26]
Plain Text: AMINATARIQ
Key: (035 % 26) = 9

Encryption
Formula: Y = (X + K) % 26
Plain Text X Y = (X + K) % 26 Y Cipher Text
A 0 (0+9) %26 9 J
M 12 (12+9) %26 21 V
I 8 (8+9) %26 17 R
N 13 (13+9) %26 22 W
A 0 (0+9) %26 9 J
T 19 (19+9) %26 2 C
A 0 (0+9) %26 9 J
R 17 (17+9) %26 0 A
I 8 (8+9) %26 17 I
Q 16 (16+9) %26 1 B
Encrypted Text: JVRWJCJAIB

Decryption
Formula: X = (Y– K) % 26
Cipher Text Y X = (Y - K) % 26 X Plain Text
J 9 (9-9) %26 0 A
V 21 (21-9) %26 12 M
R 17 (17-9) %26 8 I
W 22 (22-9) %26 13 N
J 9 (9-9) %26 0 A
C 2 (2-9) %26 19 T
J 9 (9-9) %26 0 A
A 0 (0-9) %26 17 R
I 17 (17-9) %26 8 I
B 1 (1-9) %26 16 Q
Decrypted Text: AMINATARIQ

4|P age
1.3. ROT-13 Cipher
Plain Text: AMINATARIQ
Key: 13

Encryption
Formula: Y = (X + K) % 26
Plain Text X Y = (X + K) % 26 Y Cipher Text
A 0 (0+13) %26 13 N
M 12 (12+13) %26 25 Z
I 8 (8+13) %26 21 V
N 13 (13+13) %26 0 A
A 0 (0+13) %26 13 N
T 19 (19+13) %26 6 G
A 0 (0+13) %26 13 N
R 17 (17+13) %26 4 E
I 8 (8+13) %26 21 V
Q 16 (16+13) %26 3 D
Encrypted Text: NZVANGNEVD

Decryption
Formula: X = (Y– K) % 26
Cipher Text Y X = (Y - K) % 26 X Plain Text
N 13 (13-13) %26 0 A
Z 25 (25-13) %26 12 M
V 21 (21-13) %26 8 I
A 0 (0-13) %26 13 N
N 13 (13-13) %26 0 A
G 6 (6-13) %26 19 T
N 13 (13-13) %26 0 A
E 4 (4-13) %26 17 R
V 21 (21-13) %26 8 I
D 3 (3-13) %26 16 Q
Decrypted Text: AMINATARIQ

5|P age
1.4. Monoalphabetic Cipher
Plain: abcdefghijklmnopqrstuvwxyz0123456789
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN9876543210
Plain Text: AMINATARIQ035
Encrypted Text: DCWXDUDYWM964
Decrypted Text: AMINATARIQ035

1.5. Railfence Cipher


In Railfence Cipher, encryption is achieved through the zig-zag method and
writing the text in zig-zag format according to the given key.
Key: 3

A A I

M N T R Q

I A X

Encryption
For encryption, read the text row-by-row from top to down

Encrypted Text: AAI MNTRQIAX


Decryption
For decryption, read the text column-wise written in the zig-zag format.
Decrypted Text: AMINATARIQX

1.6. Transposition Cipher


Plain Text: AMINATARIQ
Key: 53142

Encryption
6|P age
5 3 1 4 2
A M I N A
T A R I Q
Encrypted Text: IRAQMANIAT

Decryption
For decryption, read the alphabet in the table row-wise to get back the plain text.

Decrypted Text: AMINATARIQ

1.7.
Vigènere Cipher
Plain Text: AMINATARIQ

Key: NOORULAIN
Formula: Y = (X + K) % 26
A M I N A T A R I Q
N O O R U I A I N N

Encryption
Formula: Y = (X + K) % 26
Plain Text X K Y = (X + K) % 26 Y Cipher Text
A 0 13 (0+13) %26 13 N
M 12 14 (12+14) %26 0 A
I 8 14 (8+14) %26 22 W
N 13 17 (13+17) %26 4 E
A 0 20 (0+20) %26 20 U
T 19 11 (19+11) %26 4 E
A 0 0 (0+0) %26 0 A
R 17 8 (17+8) %26 25 Z
I 8 13 (8+13) %26 21 V
Q 16 13 (16+13) %26 3 D
Encrypted Text: NAWEUEAZVD

Decryption
Formula: X = (Y– K) % 26
Cipher Text Y K X = (Y– K) % 26 X Plain Text
N 13 13 (13-13) %26 0 A
7|P age
A 0 14 (0-14) %26 12 M
W 22 14 (22-14) %26 8 I
E 4 17 (4-17) %26 13 N
U 20 20 (20-20) %26 0 A
E 4 11 (4-11) %26 19 T
A 0 0 (0-0) %26 0 A
Z 25 8 (25-8) %26 17 R
V 21 13 (21-13) %26 8 I
D 3 13 (3-13) %26 16 Q

Decrypted Text: AMINATARIQ

1.8. Playfair Cipher


Plain Text: AMINATARIQ

A V Y X F
N B W Z H
O M C U I/J
P Q R D K
G S T L E

Encryption
AM IN AT AR IQ
VO HO YQ YP KM

Encrypted Text: VOHOYQYPKM

Decryption
For the decryption, the opposite rules are applied while converting the text back to
plain text.

Decrypted Text: AMINATARIQ

8|P age
1.9.
Hill Cipher
Plain Text: AMINATARIQ

0 3
Key:
5 0

A I A A I
M N T R Q
Encryption
Formula: X = YK % 26
Plain Text Y K YK % 26 X Cipher Text
𝑨 0 0 3 0 3 0 10 𝑲
* % 26
M 12 5 0 5 0 12 0 𝑨
𝑰 8 0 3 0 3 8 13 𝑵
* % 26
𝑵 13 5 0 5 0 13 0 𝑨
𝑨 0 0 3 0 3 0 5 𝑭
* % 26
𝑻 19 5 0 5 0 19 0 𝑨
𝑨 0 0 3 0 3 0 25 𝒁
* % 26
𝑹 17 5 0 5 0 17 0 𝑨
𝑰 8 0 3 0 3 8 22 𝑾
* % 26
𝑸 16 5 0 5 0 16 14 𝑶
Encrypted Text: KANAFAZAWO

Decryption
For the decryption, multiply by the inverse matrix of the key matrix.
Decrypted Text: AMINATARIQ

9|P age
10 | P a g
e

You might also like