Questions tagged [affine-cipher]

A type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple function (ax + b) mod m.

The affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter. The formula used means that each letter encrypts to one other letter, and back again, meaning the cipher is essentially a standard substitution cipher with a rule governing which letter goes to which. As such, it has the weaknesses of all substitution ciphers.

Each letter is enciphered with the function (ax + b) mod m, where b is the magnitude of the shift, and m is the length of alphabet. a has to be coprime to m in order for decryption to be possible.

Caesar's cipher is a most known example of affine cyphers, with formula (x + b) mod 26.

https://en.wikipedia.org/wiki/Affine_cipher

47 questions
8
votes
1 answer

Affine Cipher over an Affine Cipher

I would like to know your view about the title, encrypting a plain text with an affine cipher then encrypting that ciphertext once more using the same cipher, but of course different keys. Would it be more secure? For me, it won't be since it still…
5
votes
2 answers

Affine plaintext attack with GCD != 1

I'm trying to crack an affine cipher, but when cracking I cannot find the inverse of a number because the GCD is not 1. This is my plaintext and this is my ciphertext: PLAIN: 072097 108108 CIPHER: 024328 164193 This is my function: E(x) = ax + b…
4
votes
1 answer

Knowing the key, how do I decrypt the affine cipher?

I have an encryption function $$E(p) = (ap + b) \mod{26}$$ where the parameters are $a=7$, $b = 10$, and $p$ is the plaintext letter. I was asked to decrypt the ciphertext LJMKGM using this information. So, I tried to solve in this way: I…
Elior
  • 143
  • 1
  • 5
4
votes
2 answers

Have affine ciphers actually been used in practice?

I have been been studying some basic ciphers, and learnt about the affine cipher where the encryption function is given by $ax+b \pmod{26}$ for an alphabet with 26 characters. This is a very insecure cipher, so if it was used it must have been a…
Crimson
  • 49
  • 2
  • 3
4
votes
1 answer

How to attack polyalphabetic affine cipher with only ciphertext?

How to attack polyalphabetic affine cipher with only the ciphertext? A polyalphabetic affine cipher can be seen as the composition of an affine cipher ($p \mapsto c \equiv a \times p + b \pmod{26})$ and a Vigenère cipher. Consider we have a key such…
4
votes
1 answer

Affine cipher and plaintext attacks, how to find the base modulo?

Last year, a question concerning plaintext attacks was posted at Mathematics.SE: “Plaintext attacks: affine cipher”. I have no problem to see how to solve it when we are given two ciphertexts and $(c_1,c_2)$ and their corresponding plaintexts…
3
votes
2 answers

Text cipher option that can decrypt the same ciphertext to two DIFFERENT and DESIRED outputs given DIFFERENT keys (and/or alphabet)

I have a pen pal that I discuss with. In our latest discussion it was proposed to write a short message that is ciphered and have the other one find what it is, given some clues. I would like to ask if its possible to have the same ciphertext that…
3
votes
1 answer

Affine Cipher Keys that map plaintext to a given ciphertext

We first need to show that for each pair of plaintext-ciphertext letters ( x,y ), there are exactly 12 keys that encrypt x to y . For each choice of a , the key ( a,y − ax ) encrypts the plaintext letter x to the ciphertext letter y , since…
Temirzhan
  • 217
  • 2
  • 5
3
votes
2 answers

Affine Cipher - Pair of plain to cipher text

Consider an affine cipher. The cryptanalyst observed the following plaintext/ciphertext pairs $(p,c)$: $(8,15)$ and $(5,16)$. Recover the key $(a,b)$ used in the encryption system above. What is the ciphertext corresponding to the plaintext $p=3$?…
Mikeez
  • 51
  • 3
3
votes
3 answers

How is the affine cipher a permutation?

It seems there would be some collisions in what the different symbols map to, resulting in loss of information. For example, say we use the English alphabet, multiply by 2 and take the congruence mod 26. In this case, A and N will both map to the…
3
votes
2 answers

How does this affine cipher work?

I have a question about how I need to solve the following: A sentence has been changed to ASCII and then encrypted with the formula $E(x) = ax + b \bmod 256256$. All I know is that the first 4 letters are: W I S K This is the encrypted message: …
user34734
2
votes
1 answer

AES with linear S-Box

If the AES S-Box is replaced with a linear or affine transformation, for instance the identity mapping $\sigma(x)=x$, does the cipher become entirely affine and hence trivially weak?
conchild
  • 685
  • 5
  • 18
2
votes
1 answer

Affine cipher : Why it is required to have GCD(a, m) equals to 1

In the Affine cipher, the key $k = (a, b)$ should have the following property, i.e. GCD of $a$ and the modulus should be 1: $\gcd (a, m) = 1$, where $m$ is the set of possible moduli My question is, why it is required that $a$ should have the…
Vishrant
  • 123
  • 1
  • 5
2
votes
1 answer

Cracking affine cipher with plaintext

Alice and Bob decide to use the prime $p = 601$ for their affine cipher. The value of $p$ is public knowledge, and Eve intercepts the ciphertexts $c_1 = 324$ and $c_2 = 381$ and also manages to find out that the corresponding plaintexts are $m_1 =…
John
  • 21
  • 3
2
votes
1 answer

Is there a way to find $a$ and $b$ keywords in an affine cipher when only ciphertext but no plaintext is known?

I know simple formulas like $$E(x) = (ax+b)\pmod n$$ where $E(x)$ stands for encryption, $$D(y)= z(y-b)\pmod n$$ where $D(y)$ stands for decryption, and $$ax==1\pmod n$$ Assuming someone gives us an encrypted string, is there a way to find $a$ and…
onur cevik
  • 33
  • 1
  • 4
1
2 3 4