Cryptography | How to encrypt using Caeser cipher

Vihanga Hettiarahchi
3 min readJul 2, 2024

--

It is still possible to start with the Caesar Cipher and travel to the present day in terms of confidentiality.
Securing of communications through cryptography the ability to write cipher and decipher code dates back to ancient civilizations. This article will explore the basics of encryption and decryption, beginning with one of the oldest methods Out of all the algorithms it is called the Caesar Cipher.

The Caesar Cipher in Historically Speaking
One of the best-known, simplest, but original techniques of encryption is called the Caesar Cipher, according to which Julius Caesar encrypted military messages. It entails a discrete gallery in respect of the letters in the alphabet; this means that the letters in the alphabet are moved by a fixed number of positions backward or forward.

Example given below,

Example Caeser cipher

in the context of the Caesar Cipher:
P is the plaintext (the initial message) in the given message.

C is the corresponding position of every letter in the ciphertext which is obtained after having applied the shift.

We will encrypt the word, or we can call it as plain text “Portugal” using a shift of 3. Here is how you can easily follow along:

Step 01:

Write down the alphabet and assign each letter a position number

A-Z and 0–25

Step 02

As the second step for each letter in the plaintext, find its position in the alphabet.

in this example,

  • P is in position 15
  • o is in position 14
  • r is in position 17
  • t is in position 19
  • u is in position 20
  • g is in position 6
  • a is in position 0
  • l is in position 11

Step 03

Add the shift value (3 in this case) to the position. So, the positions after adding the shift value are given below.

  • P (15 + 3) = 18
  • o (14 + 3) = 17
  • r (17 + 3) = 20
  • t (19 + 3) = 22
  • u (20 + 3) = 23
  • g (6 + 3) = 9
  • a (0 + 3) = 3
  • l (11 + 3) = 14

Step 04

Use the modulo operation, but in this example all the values are within 0–25 range, so don’t need to use modulo

Step 05

Now we have to Convert the new position back to a letter.

  • 18 corresponds to s
  • 17 corresponds to r
  • 20 corresponds to u
  • 22 corresponds to w
  • 23 corresponds to x
  • 9 corresponds to j
  • 3 corresponds to d
  • 14 corresponds to o

Step 05

As the final step combined all new letters to form the encrypted message.

“ sruwxjdo “

Putting It All Together

When we combine all the new letters, “Portugal” encrypted with a Caesar Cipher and a shift of 3 becomes this,

“PORTUGAL” → “sruwxjdo”

!!! Remember always write the plain text in capital letters and cipher text in simple letters.

The Evolution of Cryptography

The second kind of cipher is the Caesar cipher, and it is characterized by simplicity and implemented ease of use, but security is not a strong point with this kind of cipher. Hence as the demand for security of the information being transmitted arose, there was enhancement of techniques that were used. In the present day, cryptography uses advanced methods to provide protection for the data.

Modern Encryption Techniques

Symmetric Key Encryption: That is, employs the same key in both the processes of encryption and decryption, the most common among the symmetric algorithms is the Advanced Encryption Standard (AES).

Asymmetric Key Encryption: Uses a set of two keys; the public and the private keys in encryption as well as decryption. The RSA algorithm is one of the most used cryptographic algorithms in asymmetric encryption.

Hash Functions: Take data and put it through a function that will change the data from a potentially large data set to a more manageable size, known as a hash value. SHA-256 is one of the popular hashing algorithms today.

--

--

Vihanga Hettiarahchi
Vihanga Hettiarahchi

Written by Vihanga Hettiarahchi

💻 Recent Cybersecurity grad. Let's build a safer digital future together. Follow for insights and discussions.

Responses (1)