7CCSMCIS Cryptography and Information Security

Coursework 2
MSc Computing and Security
5 min read

Rail fence cipher: exercises

Decrypt the following ciphertext that was generated using a rail fence cipher with 2 rails.

TEETN WRTRA HNWSE EOEBA TUSHR ISHBS KONOO MCIEA DVLPD YRHRC EBU
  1. Count characters and divide by 2 to get split point. 53/2 = 26.5, so split at H.
T E E T N W R T R A H N W S E E O E B A T U S H R I S
 H B S K O N O O M C I E A D V L P D Y R H R C E B U
  1. Gives: THE BEST KNOWN ROTOR MACHINE WAS DEVELOPED BY ARTHUR SCHERIBIUS

Use a rail fence cipher with 3 rails to encipher this message: alan turing the enigma.

A  N  R  G  E  I  A
 L  T  I  T  E  G
  A  U  N  H  N  M

Gives:
ANRGEIALTITEGAUNHNM

Rotating Grille

A more complex transposition cipher: exercise

As in the slides of the lecture, write the plaintext message:
The enigma cipher machine had the confidence of German forces who depended on its security
in a rectangle, row by row, and read the message off column by column but permute the order of the columns using the key 3571426

3571426
theenig
maciphe
rmachin
ehadthe
confide
nceofge
rmanfor
ceswhod
epended
onitsse
curityx
Columns:
3. tmrecnrceoc
5. hamhocmepnu
7. ecaaneaseir
1. eicdfonwnti
4. nphtiffhdst
2. ihihdgooesy
6. geneeerddex

1. eicdfonwnti
2. ihihdgooesy
3. tmrecnrceoc
4. nphtiffhdst
5. hamhocmepnu
6. geneeerddex
7. ecaaneaseir

Encrypted with 3571426:

eicdfonwntiihihdgooesytmrecnrceocnphtiffhdsthamhocmepnugeneeerddexecaaneaseir

Second transposition with the same key

3571426
eicdfon
wntiihi
hdgooes
ytmrecn
rceocnp
htiffhd
sthamho
cmepnug
eneeerd
dexecaa
neaseir
Columns:
3. ewhyrhscedn
5. indtcttmnee
7. ctgmeiheexa
1. diorofapees
4. fioecfmnece
2. ohecnhhurai
6. nisnpdogdar

1. diorofapees
2. ohecnhhurai
3. ewhyrhscedn
4. fioecfmnece
5. indtcttmnee
6. nisnpdogdar
7. ctgmeiheexa

Encrypted with 3571426:

diorofapeesohecnhhuraiewhyrhscednfioecfmneceindtcttmneenisnpdogdarctgmeiheexa

The ADFGVX cipher: exercise

Consider again the arrangement:

ADFGVX
A8P3D1N
DLT4OAH
F7KBC5Z
GJU6WGM
VXSVIR2
X9EY0FQ

and encrypt: The quick brown fox jumps over the lazy dog first with the key MARK and then with the key TURING.

Stage 1:

T  H  E  Q  U  I  C  K  B  R  O  W  N  F  O  X  J  U  M  P  S  O  V  E  R  T  H  E  L  A  Z  Y  D  O  G
DD DX XD XX GD VG FG FD FF VV DG GG AX XV DG VA GA GD GX AD VD DG VF XD VV DD DX XD DA DV FX XF AG DG GV

Stage 2:

M A R K
-------
D D D X
X D X X
G D V G
F G F D
F F V V
D G G G
A X X V
D G V A
G A G D
G X A D
V D D G
V F X D
V V D D
D X X D
D A D V
F X X F
A G D G
G V
A K M R
-------
D X D D
D X X X
D G G V
G D F F
F V F V
G G D G
X V A X
G A D V
A D G G
X D G A
D G V D
F D V X
V D V D
X D D X
A V D D
X F F X
G G A D
V   G
DDDGFGXGAXDFVXAXGV XXGDVGVADDGDDDVFG DXGFFDADGGVVVDDFAG DXVFVGXVGADXDXDXD

Feistel Encryption/Decryption: exercise

Show that output of decryption round 13 is equal to 32-bit swap of input to encryption round … (first identify the corresponding encryption round and then prove the equivalence).

Given:

  • $LD_{16-i} \parallel RD_{16-i} = RE_i \parallel LE_i$ .
  • Encryption: $LE_i = RE_{i-1}$ and $RE_i = LE_{i-1} \oplus F(RE_{i-1}, K_i)$ .
  • Decryption: $LD_i = RD_{i-1}$ and $RD_i = LD_{i-1} \oplus F(RD_{i-1}, K_i)$ .

We want to show that $LD_{13} \parallel RD_{13} = RE_3 \parallel LE_3$ .

Encryption:

  • $LE_3 = RE_2$
  • $RE_3 = LE_2 \oplus F(RE_2, K_3)$

Decryption:

  • $LD_{13} = RD_{12} = LE_4 = RE_3$
  • $RD_{13} = LD_{12} \oplus F(RD_{12}, K_{13})$
  • $ = RE_4 \oplus F(LE_4, K_{13})$
  • $ = RE_4 \oplus F(RE_3, K_{13})$
  • $ = [LE_3 \oplus F(RE_3, K_{13})] \oplus F(RE_3, K_{13})$
  • $ = LE_3$

Hence: $LD_{13} \parallel RD_{13} = RE_3 \parallel LE_3$ .