2018年1月17日 星期三

ITP4103 Lab 2 Symmetric Encryption

Lab 2.1 Symmetric Encryption

Caesar cipher is one of the simplest and most widely known encryption techniques. 

Here is an example:

Key = 3

Plain:   ABCDEFGHIJKLMNOPQRSTUVWXYZ_
Cipher:  DEFGHIJKLMNOPQRSTUVWXYZ_ABC

To encrypt a message, simply look up each letter of the message in the "plain" line and write down the corresponding letter in the "cipher" line. To decipher, do the reverse.
Plaintext WELCOME_TO_CIM_DEPT
Ciphertext:  ZHOFRPHCWRCFLPCGHSW

1.      Use Caesar cipher to encrypt the following text.

Key = 5

Plaintext
I
_
A
M
_
S
T
U
D
Y
I
N
G
_
I
N
_
I
V
E
Ciphertext





















2.      Use Caesar cipher to decrypt the following text.

Key = ____________________

Ciphertext
T
K
W
Z
F
P
K
I
Z
E
K
C
Z
K
X
E
N
S
Plaintext






















In the Rail Fence Cipher, the plaintext is written downwards and diagonally on successive "rails" of an imaginary fence, then moving up when we reach the bottom rail. When we reach the top rail, the message is written downwards again until the whole plaintext is written out. The message is then read off in rows.

Plaintext: WE_LIKE_COMPUTER_SO_MUCH

W





E





U





O






E



K

_



P

T



S

_



H


_

I



C

M



E

_



M

C




L





O





R





U



Ciphertext: WEUO EK_PTS_H _ICME_MC LORU

3.      Use Rail Fence Cipher to encrypt the following text.

Plaintext
P
L
E
A
S
E
_
T
R
Y
_
R
A
I
L
F
E
N
C
E
Ciphertext







































































































4.      Use Rail Fence Cipher to decrypt the following text.

Ciphertext
N
A
L
U
E
_
N
E
E
C
R
_
T
K
D
R
S
E
I
_
W
R
_
I
S
S
T
_
O
W
_
Y
Plaintext




































































































































































































In a Columnar Cipher, the message is written out in rows of a fixed length, and then read out again column by column, and the columns are chosen in some scrambled order. Both the length of the rows and the permutation of the columns are usually defined by a keyword.
Plaintext: WE_LIKE_COMPUTER_SO_MUCH
Key = 314265
3
1
4
2
6
5
Ciphertest:
E_T_ LORU WEUO _CEM KPSH IM_C
W
E
_
L
I
K
E
_
C
O
M
P
U
T
E
R
_
S
O
_
M
U
C
H


2
1
3
4
5





















5.      Use transposition cipher to encrypt the following text.

Key = 21345



Plaintext
I
_
A
M
_
S
T
U
D
Y
I
N
G
_
I
N
_
I
V
E
Ciphertext














































6.      Use transposition cipher to decrypt the following text.

Key = ____________________



Ciphertext
N
U
Y
H
T
_
V
M
H
Y
E
U
A
O
R
C
K
_
_
_
Plaintext






















沒有留言:

張貼留言