# Caesar Cipher in Cryptography

Cryptography | Caesar Cipher: In this tutorial, we will first have a brief introduction regarding this technique and then will look into how the encryption and decryption are performed in it? By Monika Sharma Last updated : May 24, 2023

## What is Caesar Cipher in Cryptography?

**Caesar cipher** is one of the well-known techniques used for encrypting the data. Although not widely used due to its simplicity and being more prone to be cracked by any outsider, still this cipher holds much value as it is amongst the firstly developed encryption techniques which gave us the idea of developing the entire encryption and decryption process.

Now, talking about its characteristics and details, **Caeser cipher** is also known as **"shift cipher"**. This is because, in this technique, we just shift the letters of the plain text to a certain number, (which is determined by the key) in a lexicographic order to obtain the ciphertext. The same number of letters in reverse lexicographic order is shifted back in the decryption process to obtain the plain text back.

The following key points can be drawn for the **Caeser cipher**,

- Caesar Cipher is also known as a shift cipher.
- It is a type of symmetric-key cryptography.
- It follows the mono-alphabetic cipher, being a part of the substitution cipher.

## Caesar Cipher Encryption Process

Here, we assume the numbers **0-25** represent the English alphabets in lexicographic order, i.e. from **a to z**.

Suppose, we have number denoting the letters of plain text denoted by **'P'**, and a key, say **'K'** (Note that it is better to choose key within the range of alphabets: **0 to 25**).

Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,

E (P, K) = ( P + K ) mod 26

## Caesar Cipher Decryption Process

Here also, the numbers **0-25** represent the English alphabets in lexicographic order, i.e. from **a to z**, and we choose the same key **'K'** that we used to encrypt our data. Suppose we denote the numbers representing the letters of the ciphertext using **'C'**.

The decryption of the ciphertext to convert it back into plain text is performed as follows,

D (C, K) = ( C - K ) mod 26

## Caesar Cipher Example

Given Plain text: 'HELLO'

Key: 3

Convert the given plain text into ciphertext:

### Solution

We write all the numbers associated with every letter of the plain text:

H : 7 E : 4 L : 11 O : 14

Therefore, applying the Caeser cipher for each letter:

E(H,3) = ( 7 + 3 ) mod 26 = 10 = K E(E, 3) = ( 4 + 3) mod 26 = 7 = H E(L, 3) = ( 11 + 3) mod 26 = 14 = O E(O, 3) = ( 14 + 3) mod 26 = 7 = R

Therefore, the ciphertext that we get for the word **'HELLO'** is **'KHOOR'**.

**Note:** You can cross-check your answer by applying the decryption process over the ciphertext, and if it comes back to be the same as the plain text, then it means that our answer is correct.

Related Tutorials

- Introduction to Cryptography
- Types of Cryptography: Symmetric and Asymmetric
- Cryptography: Caesar Cipher and its Python Implementations
- Substitution Techniques and Its Types | Cryptography
- Cryptographic Techniques: Vigenére Cipher, Playfair Cipher, Hill Cipher
- Cryptography Transposition Techniques
- Playfair Cipher in Cryptography
- Feistel Cipher in Cryptography
- Hill Cipher in Cryptography
- Diffie Hellman Algorithm in Cryptography
- Rail Fence Cipher in Cryptography
- Elliptic Curve Cryptography
- Message-Digest Algorithm 5 (MD5) in Cryptography
- Cryptography Security: Goals, Attacks, and Principles
- Vernam Cipher in Cryptography

Comments and Discussions!