# Shift Ciphers

**Shift Cipher** is one of the earliest and the simplest cryptosystems. A given plaintext is encrypted into a ciphertext by shifting each letter of the given plaintext by n positions.

The **26 letters of the alphabet are assigned numbers** as below:

0 a

1 b

2 c

3 d

4 e

5 f

6 g

7 h

8 i

9 j

10 k

11 l

12 m

13 n

14 o

15 p

16 q

17 r

18 s

19 t

20 u

21 v

22 w

23 x

24 y

25 z

An example of encrypting the plaintext by shifing each letter by 3 places.

**Plaintext**: shift cipher is simple

**Ciphertext**: vkliwflskhulvvlpsoh

Mathematically, the shift cipher encryption process is taking a letter and move it by n positions. Let

**x** be the position number of a letter from the alphabet

**n** be the an integer which **0<=n<=25**, it is the **key** for encryption and decryption of shift cipher cryptosystem

Any number (mod 26) will result in an integer less than 26 and greater than 0.

The **encryption process** is (the x here represents a letter from plaintext):

**x+n (mod 26)**

The **decryption process** is (the x here represents a letter from ciphertext):

**x-n (mod 26)**

For example, if x is 3 which represents the letter d, and n is 3 which means shift by 3 spaces, then the letter **d will become g** after encryption.

The next cryptosystem, Affine ciphers will be a little more complex and stronger than the shift ciphers.

**Search within Codexpedia**

**Search the entire web**