Atbash Cipher

Nerd Cafe

The Atbash Cipher is a substitution cipher that replaces each letter of the alphabet with its reverse counterpart. For example, in the English alphabet, 'A' is replaced with 'Z', 'B' with 'Y', and so on.

Let's go through the steps to encrypt and decrypt a message using the Atbash Cipher with a practical example.

Step-by-Step Explanation

Step 1: Understand the Atbash Cipher Rule

  • Write down the English alphabet:

Alphabet:  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
Reverse:   Z Y X W V U T S R Q P O N M L K J I H G F E D C B A

Each letter in the message is replaced by its counterpart in the reverse alphabet.

Step 2: Encrypt a Message

Suppose we want to encrypt the message: HELLO.

  1. For each letter in "HELLO", find its reverse counterpart:

  • H → S

  • E → V

  • L → O

  • L → O

  • O → L

  1. Replace the letters to get the ciphertext: SVOOL.

Step 3: Decrypt a Message

Decrypting is the same as encrypting because the Atbash Cipher is symmetric:

  1. For each letter in "SVOOL", find its reverse counterpart:

  • S → H

  • V → E

  • O → L

  • O → L

  • L → O

Replace the letters to get the original plaintext: HELLO.

Practical Python Implementation

Here’s how you can implement the Atbash Cipher in Python:

Output:

Last updated