Вы находитесь на странице: 1из 12

1. Convert the following Plaintext into Cipher text using Caesar cipher method.

Plain Text: Attack at dawn, Key = 7.

Plain Text: Hello, Key = 15.

En(x)=(x+n) mod 26

Answer:

i)

Plain Text=Attack at dawn, Key =7

A: for A x=0

En(A)=(0+7)mod26=H

En(A)=H

T: for T x=19

En(T)=(19+7) mod 26

En(T)=0=A

C: x=2

En(c)=(2+7)mod 26=9 mod 26=j

En(c)=j

K: x=10

En(k)=(10+7)mod 26=17 mod 26=R

En(k)=R

D: x=3
En(D)=(3+7)mod 26=10 mod 26

En(D)=k

W:x=22

En(W)=(22+7)mod 26

En(w)=29 mod 26=3

En(w)=D

N: x=13

En(N)=(13+7)mod 26

En(N)=20 mod 26

En(N)=U

Therefore: Attack at Dawn is written as HAAHJR HA KHDU

ii)

Plain Tect=Hello Key=15

En(x)=(x+n)mod 26 where n=15

H: x=7

En(H)=(7+15)mod 26=22mod 26=22=W

h=>W

e:x=4

En(e)=(4+15)mod 26=19 mod 26=19=T

e=>T
l:x=11

En(l)=(11+15)mod 26=26mod 26=0=A

l=>A

o:x=14

En(o)=(14+15)mod 26=29mod 26=3=D

o=>D

Hello => WTAAD

2. Decrypt the text to identify the plain text using Caesar cipher method.

Cipher Text: govmywo kvv dy mbizdyqbkzri kxn xodgybu comebsdi mvkcc, Key = 10

Dn(x)=(x-n) mod 26

G: x=6

dn(g)=(6-10)mod 26=-4mod26=(26-4)mod 26=22mod26=22=W

dn(g)=W

O: x=14

dn(o)=(14-10)mod 26=4 mod 26=4=E

dn(o)=E

V: x=21

dn(V)=(21-10)mod 26=11 mod 26=11=L

dn(V)=L
M: x=12

dn(M)=(12-10)mod 26=2 mod 26=C

dn(M)=c

y:x=24

dn(Y)=(24-10)mod 26=14 mod 26=14=o

dn(Y)=o

W:dn(w)=(22-10)mod 26=12 mod 26=M

dn(w)=M

K: x=10

dn(K)=(10-10)mod 26=0=A

dn(K)=A

D:x=3

dn(D)=(3-10)mod 26=-7mod26=(26-7)mod 26=19=T

dn(D)=T

B:x=1

dn(B)=(1-10)mod 26=(-9)mod 26=26-9 mod 26=R

dn(D)=R

i:x=8

dn(i)=(8-10)mod 26=(-2)mod 26=Y

dn(i)=y

z;x=25
dn(z)=(25-10)mod 26=P

dn(z)=P

q:x=16

dn(q)=(16-10)mod 26=G

dn(q)=g

r:x=17

dn(r)=(17-10)mod 26=H

dn(r)=H

x:x=23

dn(x)=(23-10)mod 26=N

dn(x)=N;

n:x=13

dn(x)=(13-10)mod 26=D

dn(x)=D

u:x=20

dn(u)=(20-10)mod 26=k

dn(u)=k

c:x=2

dn(c)=(2-10)mod 26=s

dn(c)=s

e:x=4
dn(e)=(4-10)mod 26=U

S: x=18

dn(e)=(18-10)mod 26=I

govmywo kvv dy mbizdyqbkzri kxn xodgybu comebsdi mvkcc=> Welcome all to cryptography
and network security class

3. Using Play fair cipher Encrypt the following. Use X for Blank Spaces.

Keyword: MONARCHY.

Message: SWARAJ IS MY BIRTH RIGHT.

M O N A R

C H Y B D

E F G I/J K

L P Q S T

U V W X Z

SW AR AJ IS MY BI RT HR IG HT

SW:

Is in different row and column


Therefore

s=>Q

w=>X

AR:

In same Row

Therefore

A=>R

R=>M

AJ:

In same column

Therefore

A=>B

J=>S

IS:

In same column

Therefore

I=>s

S=>x
My:

In different row and column

M=>N

y=>c

BI:

In same column

B=>I

I=>s

RT:

In same column

R=>d

t=>z

HR:

In different row and column

H=>d

R=>o
IG:

In same Row

i=>k

g=>I

HT

In different row and column

H=>D

T=>P

therefore:Swaraj is my birth right is written as

QXRMBS SX NC ISDZD OKIDP

4. Perform Encryption and Decryption using HILL CIPHER for the following

Message: PEN and Key: ACTIVATED

Activated = 0` 2` 19

8` 21` 0

19` 4` 3
PEN= 15

13

Encryption:

K(Plaintext)mod26

0 2 19 15 255 21

8 21 0 4 = 204 mod 26= 22

19 4 3 13 340 2

21 V

22 = W

2 C

Therefore, Cipher text is VWC

Decryption:

P=K^-1Cmod26

0 2 19

Key= 8 21 0

19 4 3

k^-1=1/|k| * adj K

|k| = 0-2(24)+19(32-399)=-7021
Multiplicative inverse of determinant:

k.k^-1 = 1mod26

-7021 * 25 * mod26 = 1

K^-1 = 25

63 70 -399

Adjoint of k = -24 -361 152

-367 38 -16

Remove negative(-) signs

63 70 17 (26*17= 416, 416-399 = 17)

2 3 152

23 38 10

Now k^-1 = |k^-1| adj K

63 70 17

25 2 3 152

23 38 10

1575 1750 425

50 75 3800

575 950 250

Find modulus

1575 1750 425

50 75 3800 mod 26

575 950 250


15 8 9

25 23 4

3 14 16

P=K^-1Cmod26

15 8 9 21 509

25 23 4 22 = 1018 mod 26

3 14 16 2 403

15 P

4 E

13 N

DECRYPTED MESSAGE – PEN

Вам также может понравиться