Atbash Cipher Algorithm

The Atbash Cipher is a monoalphabetic substitution cipher that was originally used for the Hebrew alphabet. It is one of the earliest known subtitution ciphers to have been used. As opposed to a Caesar Cipher, the Atbash cipher does not need a key. It is hence easier to break!

The Atbash Cipher maps each letter of an alphabet it to its reverse, so that the first letter (e.g. A) becomes the last letter (e.g. Z), the second letter (B) becomes the second to last letter (Y), and so on.

Using the Latin Alphabet

Plain 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
Cipher 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

Using the Hebrew Alphabet

  Aleph Bet Gimel Daleth Heh Vav Zayin Het Tet Yodh Kaph Lamed Mem Nun Samech Ayin Peh Tzady Koof Reish Shin Taw
Plain א ב ג ד ה ו ז ח ט י כ ל מ נ ס ע פ צ ק ר ש ת
  Taw Shin Reish Koof Tzady Peh Ayin Samech Nun Mem Lamed Kaph Yodh Tet Het Zayin Vav Heh Daleth Gimel Bet Aleph
Cipher ת ש ר ק צ פ ע ס נ מ ל כ י ט ח ז ו ה ד ג ב א

Encryption/Decryption Algorithm

Note that the same algorithm can be used to encrypt a plaintext into a ciphertext or to decrypt a ciphertext into a plaintext.

The flowchart below is used to encrypt or decrypt text using the Atbash Cipher. To fully understand this algorithm, you will need to understand how ASCII code works. The algorithm above is using the ASCII codes for the uppercase alphabet from letter A (ASCII 65) to letter Z (ASCII 90).


We can then use this function in a program used to retrieve the plaintext to encrypt (or ciphertext to decrypt) from the end user:

Python Code

Your task is to implement the above algorithms using Python:

Share Button
Tagged with: ,