You are on page 1of 18

Matemticas Aplicadas a la Informtica

Symmetric cryptosystems
Fco. Javier Lobillo
Departamento de lgebra
Curso 2011/2012
Symmetric Cryptosystems
1 Abstract cryptosystems
2 Caesar cipher
3 Monoalphabetic cipher.
4 Vigenre cryptosystem (polyalphabetic substitution)
5 Hill cryptosystem
6 A few words on information theory
7 Symmetric Cryptosystems
8 Stream ciphers
9 Block ciphers
DrriNiticN
The sets , and . are both the set Z
27
= |0 1 26|, and the key
space is l = Z
27
\ |0|. Encryption and decryption transforms are for
each k l
e
k
(m) = m +k (mod 27)
and
d
k
(c) = c k (mod 27)
Prv/nk
d
k
= e
27k
Symmetric Cryptosystems
1 Abstract cryptosystems
2 Caesar cipher
3 Monoalphabetic cipher.
4 Vigenre cryptosystem (polyalphabetic substitution)
5 Hill cryptosystem
6 A few words on information theory
7 Symmetric Cryptosystems
8 Stream ciphers
9 Block ciphers
Again the sets , and . are Z
27
= |0 1 26|, but the key space is
l = S
27
, the permutation group of the set |0 1 26|. For each
S
27
and each plaintext m = x
1
x
2
x
n
the encryption function e

is
dened by:
e

(m) = (x
1
)(x
2
) (x
n
)
The decryption function d

is dened by
1
, i.e.,
d

= e

1
Consider this text in spanish:
PARTES DE LA MATEMATICA QUE POSEEN GRAN INTERES PERO
NO SE DEJAN FORMULAR EN TERMINOS DE ESTRUCTURAS Y SUS
INTERACCIONES COMO PUEDE SER EL CASO DE LA TEORIA DE
GRUPOS FINITOS O LA TEORIA ANALITICA DE NUMEROS
We break it in length one blocks
p,a,r,t,e,s,d,e,l,a,m,a,t,e,m,a,t,i,c,a,q,u,e,p,o,s,e,e,n,g,r,a,n,i,n,t,e,r
e,s,p,e,r,o,n,o,s,e,d,e,j,a,n,f,o,r,m,u,l,a,r,e,n,t,e,r,m,i,n,o,s,d,e,e,s,t
r,u,c,t,u,r,a,s,y,s,u,s,i,n,t,e,r,a,c,c,i,o,n,e,s,c,o,m,o,p,u,e,d,e,s,e,r,e
l,c,a,s,o,d,e,l,a,t,e,o,r,i,a,d,e,g,r,u,p,o,s,f,i,n,i,t,o,s,o,l,a,t,e,o,r,i
a,a,n,a,l,i,t,i,c,a,d,e,n,u,m,e,r,o,s
Each block is encoded by the corresponding number,
16,0,18,20,4,19,3,4,11,0,12,0,20,4,12,0,20,8,2,0,17,21,4,16,15
19,4,4,13,6,18,0,13,8,13,20,4,18,4,19,16,4,18,15,13,15,19,4,3
4,9,0,13,5,15,18,12,21,11,0,18,4,13,20,4,18,12,8,13,15,19,3,4
4,19,20,18,21,2,20,21,18,0,19,25,19,21,19,8,13,20,4,18,0,2,2,8
15,13,4,19,2,15,12,15,16,21,4,3,4,19,4,18,4,11,2,0,19,15,3,4,11
0,20,4,15,18,8,0,3,4,6,18,21,16,15,19,5,8,13,8,20,15,19,15,11
0,20,4,15,18,8,0,0,13,0,11,8,20,8,2,0,3,4, 13,21,12,4,18,15,19
Let be the permutation
= (1 3 5 7 9 11)(0 4 18 22 25 21 2 8)
(15 16 6 13 14 12 20 23 24 17 19)(10 26)
If we apply to the text we obtain
6,4,22,23,18,15,5,18,1,4,20,4,23,18,20,4,23,0,8,4,19,2, 18,6,16,15,18,18,14
13,22,4,14,0,14,23,18,22,18,15,6,18,22,16,14,16,15,18,5,18,11,4,14,7,16,22
20,2,1,4,22,18,14,23,18,22,20,0,14,16,15,5,18,18,15,23,22,2,8,23,2,22,4,15
21,15,2,15,0,14,23,18,22,4,8,8,0,16,14,18,15,8,16,20,16,6,2,18,5,18,15,18,22
18,1,8,4,15,16,5,18,1,4,23,18,16,22,0,4,5,18,13,22,2,6,16,15,7,0,14,0,23,16
15,16,1,4,23,18,16,22,0,4,4,14,4,1,0,23,0,8,4,5,18,14,2,20,18,22,16,15
which can be decoded to letters as:
g,e,v,w,r,o,f,r,b,e,t,e,w,r,t,e,w,a,i,e,s,c,r,g,p,o,r,r,, n,v,e,,a,,w,r
v,r,o,g,r,v,p,,p,o,r,f,r,l,e,,h,p,v,t,c,b,e,v,r,,w,r,v, t,a,,p,o,f,r,r
o,w,v,c,i,w,c,v,e,o,u,o,c,o,a,,w,r,v,e,i,i,a,p,,r,o,i,p, t,p,g,c,r,f,r,o
r,v,r,b,i,e,o,p,f,r,b,e,w,r,p,v,a,e,f,r,n,v,c,g,p,o,h,a,, a,w,p,o,p,b,e,w
r,p,v,a,e,e,,e,b,a,w,a,i,e,f,r,,c,t,r,v,p,o
Hence the cyphertext is:
GEVWROFRBETEWRTEWAIESCRGPORRNVEAWR
VROGRVPPORFRLEHPVTCBEVRWRVTAPOFRR
OWVCIWCVEOUOCOAWRVEIIAPROIPTPGCRFRO
RVRBIEOPFRBEWRPVAEFRNVCGPOHAAWPOPBEW
RPVAEEEBAWAIEFRCTRVPO
A brute force attack is non-viable because the size of the key space is
[S
27
[ = 27! = 10888
4
869450
3
418352
2
160768
1
000000 10
28

But the frequency analysis allows to recover the plaintext from the
cyphertext without the knowledge of the key. We use the following
table of frequencies corresponding to spanish texts
letter prob. letter prob. letter prob.
E 0,147 U 0,046 Y 0,013
A 0,11 D 0,044 B 0,012
O 0,096 C 0,042 H 0,01
S 0,085 T 0,042 G 0,008
N 0,069 M 0,03 V 0,008
R 0,065 P 0,028 F 0,007
I 0,056 Q 0,021 J 0,003
L 0,054 Z 0,002
X 0,001
0,0008
K 0,0000002
W 0,0
In our text we have the following frequencies:
letter freq. letter freq. letter freq. letter freq.
A 11 I 7 P 15 X 0
B 6 J 0 Q 0 Y 0
C 8 K 0 R 27 Y 0
D 0 L 1 S 1
E 18 M 0 T 6
F 7 N 2 U 1
G 5 12 V 15
H 2 0 15 W 12
So we can assume that R ciphers the letter E and the letter E ciphers
the letter A.
GaVWeOFeBaTaWeTaWAIaSCeGPOeeNVaAWe
VeOGeVPPOeFeLaHPVTCBaVeWeVTAPOFee
OWVCIWCVaOUOCOAWeVaIIAPeOIPTPGCeFeO
eVeBIaOPFeBaWePVAaFeNVCGPOHAAWPOPBaW
ePVAaaaBAWAIaFeCTeVPO
The highest frequencies after R and E are O, P and V, which can cipher
O, S, N, R, I, or L, the next frequences in spanish. We make two
assumptions: O S, P O and V N or R.
Option 1
GanWesFeBaTaWeTaWAIaSCeGoseeNnaAWe
nesGenooseFeLaHonTCBaneWenTAosFee
sWnCIWCnasUsCsAWenaIIAoesIoToGCeFes
eneBIasoFeBaWeonAaFeNnCGosHAAWosoBaW
eonAaaaBAWAIaFeCTenos
or
Option 2
GarWesFeBaTaWeTaWAIaSCeGoseeNraAWe
resGerooseFeLaHorTCBareWerTAosFee
sWrCIWCrasUsCsAWeraIIAoesIoToGCeFes
ereBIasoFeBaWeorAaFeNrCGosHAAWosoBaW
eorAaaaBAWAIaFeCTeros
The next high frequencies are A, and W, which can cipher I, L, (N or
R) or any in the column U, D, C, T,. . . to follow the process.
If we know that the word MATEMATICA" is in the plaintext, the
segment TaWeTaWAIa" can be the corresponding part of the ciphertext.
Hence T ciphers the letter M, W the letter T, A the letter I and I the
letter C; option 2 seems to be the correct one and we have:
Option 2
GartesFeBamatematicaSCeGoseeNraite
resGerooseFeLaHormCBaretermiosFee
strCctCrasUsCsiteraccioescomoGCeFes
ereBcasoFeBateoriaFeNrCGosHiitosoBat
eoriaaaBiticaFeCmeros
We must guess who is ciphering the letter N. The highest remaining
frequence is , then we have:
Option 2
GartesFeBamatematicaSCeGoseenNraninte
resGeronoseFeLanHormCBarenterminosFee
strCctCrasUsCsinteraccionescomoGCeFes
ereBcasoFeBateoriaFeNrCGosHinitosoBat
eoriaanaBiticaFenCmeros
It remains a vowel. We try the letter C
Option 2
GartesFeBamatematicaSueGoseenNraninte
resGeronoseFeLanHormuBarenterminosFee
structurasUsusinteraccionescomoGueFes
ereBcasoFeBateoriaFeNruGosHinitosoBat
eoriaanaBiticaFenumeros
Next we make the changes G P, F D, B L.
Option 2
partesdelamatematicaSueposeenNraninte
resperonosedeLanHormularenterminosdee
structurasUsusinteraccionescomopuedes
erelcasodelateoriadeNruposHinitosolat
eoriaanaliticadenumeros
Now S Q, N G, H F, U Y.
Option 2
partesdelamatematicaqueposeengraninte
resperonosedeLanformularenterminosdee
structurasysusinteraccionescomopuedes
erelcasodelateoriadegruposnitosolat
eoriaanaliticadenumeros
and nally J L.
Option 2
partesdelamatematicaqueposeengraninte
resperonosedejanformularenterminosdee
structurasysusinteraccionescomopuedes
erelcasodelateoriadegruposnitosolat
eoriaanaliticadenumeros

You might also like