# Implementing Atbash Cipher

Atbash Cipher is a type of substitute cipher in which we can reverse all the alphabet letters in reverse order with the help of a single cipher key. We can change the order of A-Z to Z-A. It is used to encode the alphabet into the Hebrew alphabet.

### Relationship to Affine

Atbash cipher is a part of Affine cipher in which both keys are used. In Affine cipher, a= 25 and b=25.

### Algorithm

The keys which are used in Atibash Cipher are as follows.

Encryption

To encrypt a message, we need to choose the word from the above letters. Then we have to replace the letter with the below letter. Suppose we have the word "JAVATPOINT ."The first letter of the word is J, which can be replaced with Q .The second letter is A, which can be replaced with Z. The third letter of the word is V, which can be replaced with E. The letter T can be replaced with G. The letter P can be replaced with L. The letter O can be replaced with M. The letter I can be replaced with R.. The letter N can be replaced with M. The whole message can be encrypted as below.

### Decryption

Similarly, if we want to decrypt the message "QZEZGKLRMG," it can be possible by following the above steps. The letter Q can be replaced with J. The letter Z can be replaced with A. The letter E can be replaced with V. The letter G can be replaced with T. The letter K can be replaced with P. The letter L can be replaced with O. The letter R can be replaced with I. The letter M can be replaced with N .The whole message can be decrypted as below.

## The Approach

Here, we can perform the mapping operation of every element with the help of a key value. It looks for the pair in the dictionary, and with the help of the above series, the encryption and decryption process takes place.

### Example:

Output:

```QZEZGKLRMG
JAVATPOINT
```

Atbash cipher has both a=25 and b=25. So we do not need to write the different functions for encryption and decryption. So we can reuse the same function for both encryption and decryption.

It has one constant key it is the easiest cipher to break and provides almost no security. Anyone can assume that it is Atbash and decrypt the message by reversing the letters.

Next Topic