Cryptography - MonoAlphabetic Cipher



The substitution cipher is one of the oldest types of encryption algorithms because it produces each character in a plaintext message and then uses a substitution method to replace it with a new character in the ciphertext.

The Monoalphabetic Substitution Cipher is also known as the "Simple Substitution Cipher". Monoalphabetic Substitution Ciphers use an individual key mapping function K to replace a specific character α with a character from the mapping K (α).

A mono-alphabetic substitution cipher is one in which the equivalent letters of the plaintext are replaced with the identical letters from the ciphertext. Mono, which means one, indicates that each letter of the plaintext has a single substitution in the ciphertext.

Characteristics

Mono-alphabetic ciphers are a type of substitution wherein the connection among a symbol in the plaintext and a symbol in the ciphertext is continually one-to-one and remains regular during the encryption system.

Example: Caesar cipher

Caesar cipher is a monoalphabetic cipher. It uses a similar replacement mechanism to get the ciphertext characters for each plaintext character. Caesar cipher makes it easy for a hacker to crack the key because it only supports 25 keys in total. This pit is covered with a monoalphabetic cipher.

Example Analysis

If the plaintext is "TREE", the ciphertext can be "ADOO", indicating that the cipher is potentially mono-alphabetic because both "O"s in the plaintext are encrypted with "E"s in the cypher text.

Types of Monoalphabetic Ciphers

There are mainly 4 types of Mono-alphabetic Ciphers −

Additive Ciphers

Additive ciphers are monoalphabetic ciphers that change each individual character in the plaintext to a different character within the ciphertext based totally on the key value utilised.

For example, if the plaintext carries the character 'a' and the value of the key is 4, 'a' will be replaced with 'e' because to the fact that 'e' is 4 characters away from 'a' according to the key we have used for the additive monoalphabetic cipher process.

The additive cipher is mathematically represented as follows −

To encrypt plaintext using an additive monoalphabetic cipher, use the formula C=(P+k) mod 26. In this, P represents the plaintext character, k is the encryption key, and C offers the needed ciphertext.

The formula for decrypting ciphertext to plaintext in additive ciphers is P=(C-k) mod 26. Here, P is the plaintext, C is the ciphertext to be converted, and k is the key.

Caeser Cipher

Caeser cipher is a monoalphabetic cipher in which each character in plaintext is transferred to another character by a distance of three. It is simply an additive cipher with a constant key value of 3.

For example, if the plaintext contains the character 'a', the ciphertext counterpart will have the value 'd' because the Caeser cipher's key value is 3.

The Caeser cipher is mathematically represented as follows −

Encryption Process − The Caeser cipher uses the formula C=(P+3) mod 26 to encode plaintext into ciphertext. Here, P is the plaintext, C is the ciphertext, and 3 is the key, which is always the same in the Caeser cipher.

Decryption process − To decrypt ciphertext into plaintext using Caeser cipher, use the formula P=(C-3) mod 26. In this example, P and C represent plaintext and ciphertext, respectively, while 3 is the key.

Multiplicative Cipher

A multiplicative cipher is a sort of monoalphabetic cipher in which a character in the plaintext is multiplied by the key, followed by the modulus function.

For example, if the plaintext contains the character 'h' and the key is set to 4, the value of the ciphertext is 'x'.

Multiplicative cipher is mathematically represented as follows −

Encryption Process − To encrypt plaintext using a multiplicative cipher, use the formula C=(P*k) mod 26. Here, P represents plaintext, C is ciphertext, and K is the key.

Decryption Process − The formula for decrypting ciphertext to plaintext in multiplicative ciphers is P=(C*multiplicative inverse of k) mod 26.

Affine Cipher

Affine cIpher is one of the most powerful monoalphabetic ciphers. The affine cipher has two keys and uses a combination of additive and multiplicative ciphers to generate ciphertext from plaintext.

The mathematical representation of the affine cipher is −

Encryption process − To encrypt plaintext in an affine cipher, use the formula C=(P*k1+k2) mod 26. Here, C represents ciphertext, P represents plaintext, and k1 and k2 are the two keys used in an affine cipher.

Decryption Process − The formula for decrypting ciphertext to plaintext in an affine cipher is P=((C-k2)/k1) mod 26.

Advantages

The substitute character symbols in Monoalphabetic cipher allow for a random permutation of 26 letters of the alphabet 26! The maximum number of alphabet permutations is 4*10^26. This complicates the hacker's ability to get the key using brute force attacks.

Vulnerability

The Monoalphabetic Substitution cipher is vulnerable to frequency analysis attacks; such ciphers are not safe and are susceptible to a variety of attacks, one of them being their fixed key substitution. We will look at how frequency analysis-based attacks can be used against various ciphers.

The concept behind frequency analysis depends on the fact that each letter in any language has a unique personality. The most noticeable characteristic of letters is the frequency with which they appear in a language. In English, the letter "Z" appears significantly less frequently than "A". In the past, if you wanted to determine the frequencies of letters inside a language, you had to discover a significant amount of text and count each frequency. Now, however, we have computers that can do all of the work for us. But we do not even need to go to this phase because most languages have very precise letter frequency databases compiled from millions of documents.

For example, if 'N' is encrypted with 'R' multiple times in a plaintext message, it will always be encrypted to 'R'.

Summary

Although the hacker will not be able to use brute force attacks, it is possible to consider the key utilising the All-Fearsome Statistical Attack. If a hacker understands the properties of any substitution cipher's plaintext, it can easily break the cipher using a statistical attack, whatever the size of the key space. Statistical attacks involve analysing the frequency distribution of characters and comparing them to the same data for English.

Advertisements