Encryption of Caesar

Encryption of Caesar

In the first century B. C. appears a basic cipher known as the generic cipher of Caesar in honor of Emperor Julius Caesar and in which a transformation is already applied to the monoalphabetic clear text

The cipher of Caesar applied a constant displacement of b characters to the text in clear

Example of encryption is the Caesar

We take b equal to 3, so that the alphabet of the cipher is the same as the alphabet of the text in clear but shifted 3 spaces to the right module n, with n the number of letters in the same

To encrypt we will use:

C_i\equiv(M_i+b)\pmod{n}

To decrypt we will use:

M_i\equiv(C_i+n-b)\pmod{n}

In the English alphabet, as there are 26 letters, n will be 26

We have the following message that we want to encrypt:

C=MESSAGE SENT YESTERDAY

Their characters clearly correspond to the following matrix:

\tiny\begin{pmatrix} 0& 1& 2& 3& 4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20& 21& 22& 23& 24& 25 \\ A& B& C& D& E& F& G& H& I& J& K& L& M& N& O& P& Q& R& S& T& U& V& W& X& Y& Z \\ \end{pmatrix}

\tiny\begin{pmatrix} 12& 4& 18& 18& 0& 6& 4& 18& 4& 13& 19& 24& 4& 18& 19& 4& 17& 3& 0& 24 \\ M& E& S& S& A& G& E& S& E& N& T& Y& E& S& T& E& R& D& A& Y \\ \end{pmatrix}

We get the following results:

\begin{array}{l} (12+3)\pmod{26}\equiv 15 \\ (4+3)\pmod{26}\equiv 7 \\ (18+3)\pmod{26}\equiv 21 \\ (18+3)\pmod{26}\equiv 21 \\ (0+3)\pmod{26}\equiv 3 \\ (6+3)\pmod{26}\equiv 9 \\ (4+3)\pmod{26}\equiv 7\\ (18+3)\pmod{26}\equiv 21 \\ (4+3)\pmod{26}\equiv 7 \\ (13+3)\pmod{26}\equiv 16 \\ (19+3)\pmod{26}\equiv 22 \\ (24+3)\pmod{26}\equiv 1 \\ (4+3)\pmod{26}\equiv 7 \\ (18+3)\pmod{26}\equiv 21 \\ (19+3)\pmod{26}\equiv 22 \\ (4+3)\pmod{26}\equiv 7 \\ (17+3)\pmod{26}\equiv 20 \\ (3+3)\pmod{26}\equiv 6 \\ (0+3)\pmod{26}\equiv 3 \\ (24+3)\pmod{26}\equiv 1 \end{array}

by applying the transformation P+3\pmod{26} become

\tiny\begin{pmatrix} 15& 7& 21& 21& 3& 9& 7& 21& 7& 16& 22& 1& 7& 21& 22& 7& 20& 6& 3& 1 \\ P& H& V& V& D& J& H& V& H& Q& W& B& H& V& W& H& U& G& D& B \\ \end{pmatrix}

So the encrypted message is:

M=PHVVDJHVHQWBHVWHUGDB

We can decipher the M previous:

\begin{array}{l} (15+26-3)\pmod{26}\equiv 12 \\ (7+26-3)\pmod{26}\equiv 4 \\ (21+26-3)\pmod{26}\equiv 18 \\ (21+26-3)\pmod{26}\equiv 18 \\ (3+26-3)\pmod{26}\equiv 0 \\ (9+26-3)\pmod{26}\equiv 6 \\ (7+26-3)\pmod{26}\equiv 4 \\ (21+26-3)\pmod{26}\equiv 18 \\ (7+26-3)\pmod{26}\equiv 4 \\ (16+26-3)\pmod{26}\equiv 13 \\ (22+26-3)\pmod{26}\equiv 19 \\ (1+26-3)\pmod{26}\equiv 24 \\ (7+26-3)\pmod{26}\equiv 4 \\ (21+26-3)\pmod{26}\equiv 18 \\ (22+26-3)\pmod{26}\equiv 19 \\ (7+26-3)\pmod{26}\equiv 4 \\ (20+26-3)\pmod{26}\equiv 17 \\ (6+26-3)\pmod{26}\equiv 3 \\ (3+26-3)\pmod{26}\equiv 0 \\ (1+26-3)\pmod{26}\equiv 24 \end{array}

\tiny\begin{pmatrix} 12& 4& 18& 18& 0& 6& 4& 18& 4& 13& 19& 24& 4& 18& 19& 4& 17& 3& 0& 24 \\ M& E& S& S& A& G& E& S& E& N& T& Y& E& S& T& E& R& D& A& Y \\ \end{pmatrix}

Getting the original c: C=MESSAGESENTYESTERDAY

This system of encryption, simple, appropriate and even pretty ingenious for the time, presents a level of security very weak

Cryptanalysis of the encryption of Caesar

In the event a substitution is fixed for each character of the alphabet in clear by a single character of the alphabet of the cipher, the cryptogram will be able to easily break using statistical techniques of the language, always and when we have a sufficient amount of cipher text

The distance of the uniqueness is given by the ratio between the entropy of the key H(K) and the redundancy of the language D. therefore, if n = 26, there are only 25 possible combinations of alphabets, therefore H(K)=\log_2{25}=4,64

As the redundancy D was equal to 4.03 then you have to N=\frac{H(K)}{D}\approx\frac{4,64}{4,03}\approx 1,15. Therefore, we need a minimum of 2 characters

An elementary form of cryptanalysis is to write under the text encryption all the combinations of phrases, with or without meaning, which are obtained by applying to said cryptogram displacement of 1, \cdots, n-1 characters, n being the number of characters of the alphabet used. One of these combinations will give with the clear text and this will be true regardless of the value assigned to the constant displacement

b Cipher
1 QIWWEKIWIRXCIWXIVHEC
2 RJXXFLJXJSYDJXYJWIFD
3 SKYYGMKYKTZEKYZKXJGE
4 TLZZHNLZLUAFLZALYKHF
5 UMAAIOMAMVBGMABMZLIG
6 VNBBJPNBNWCHNBCNAMJH
7 WOCCKQOCOXDIOCDOBNKI
8 XPDDLRPDPYEJPDEPCOLJ
9 YQEEMSQEQZFKQEFQDPMK
10 ZRFFNTRFRAGLRFGREQNL
11 ASGGOUSGSBHMSGHSFROM
12 BTHHPVTHTCINTHITGSPN
13 CUIIQWUIUDJOUIJUHTQO
14 CUIIQWUIUDJOUIJUHTQO
15 EWKKSYWKWFLQWKLWJVSQ
16 FXLLTZXLXGMRXLMXKWTR
17 GYMMUAYMYHNSYMNYLXUS
18 HZNNVBZNZIOTZNOZMYVT
19 IAOOWCAOAJPUAOPANZWU
20 JBPPXDBPBKQVBPQBOAXV
21 KCQQYECQCLRWCQRCPBYW
22 LDRRZFDRDMSXDRSDQCZX
23 MESSAGESENTYESTERDAY
24 NFTTBHFTFOUZFTUFSEBZ
25 OGUUCIGUGPVAGUVGTFCA

I could easy say that a system of encryption by substitution monoalfabética as he Cesar presents a minimal level of security in both support of romero, we have been how to a pencil, and a little bit of patience and support to make him box before, nothing out of this world

This weakness is due to that the number of possible offsets is very small, counting only with the 25 values that correspond to the characters of the alphabet; that is, it is true that 1\leq b\leq 25since a displacement equal to zero or a multiple of twenty-six would be equal to that transmit in the clear

Is to be fulfilled by both the following decryption operation is D from a And encryption in the ring n:

D_b=E_{n-b}\Rightarrow D_3=E_{26-3}=E_{23}