# Caesar cipher

The Caesar cipher is a simple substitution cipher algorithm, which was used by Julius Caesar to protect confidential communications such as military messages.

In its classic version, this algorithm uses uppercase letters A to Z, but another alphabet can be used. It consists in replacing each letter of the message to be encoded, by a letter which is at a fixed distance in the alphabet. The distance the letters are offset is called the "key".

**Example**

With a key (or offset) of 3, A is encoded in D (D being the 3rd letter from A) and B is encoded in E (E being the 3rd letter from B). Here are the alphabet letters (in 1st line) and their encoded form in 2nd line (read A->D, B->E until Z->C),

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

D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.A.B.C

This algorithm is also called ROT3 (like rotation 3). In order to encode the letters at the end of the alphabet, for example Y, we make a rotation and consider that Z is followed by A. We thus have the sequence ...Y-Z-A-B... . So, Y is encoded in B.

The encrypted message can be decrypted by shifting the letters to left using the same key. However, since only 26 letters are involved, there are therefore 25 possible offsets. Hence, the Caesar cipher can easily be broken by methods such as frequency analysis or "brute force" which consists of testing all possibilities. In the calculator above, to apply the "brute force" method, choose the 'unknown' value in the key selector.