14 votes
Accepted

Affine Cipher over an Affine Cipher

If you combine two affine ciphers, you obtain one affine cipher. Say the first cipher is $e_1(x) = a_1x+b_1$ and the second is $e_2(x) = a_2x+b_2$. Then $e_1(e_2(x)) = a_1(a_2x+b_2)+b_1 = (a_1a_2)x+(...
user avatar
  • 7,914
6 votes
Accepted

AES with linear S-Box

does the cipher become entirely affine and hence trivially weak? Yes; the AES sbox is the only source of nonlinearity (the ShiftRows and MixColumns are linear, and AddRoundKeys for a fixed key is ...
user avatar
  • 134k
6 votes

How does this affine cipher work?

W is 87 in ASCII, so $$ 87a+b\equiv064066\pmod{256256}. $$ I is 73 in ASCII, so $$ 73a+b\equiv158368\pmod{256256}. $$ ...
user avatar
  • 528
6 votes
Accepted

Where did affine cipher get its name from?

In mathematics (specifically in linear algebra) an affine transformation is a combination of a linear transformation and a translation, i.e. a map of the form: $$x \mapsto ax + b$$ where $a$ and $b$ ...
user avatar
5 votes

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

Well, to start off with, we have: $$k_1 m_1 + k_2 - n_1 p = c_1$$ $$k_1 m_2 + k_2 - n_2 p = c_2$$ $$k_1 m_3 + k_2 - n_3 p = c_3$$ Where we know $m_1, c_1, m_2, c_2, m_3, c_3$, and we don't know $k_1,...
user avatar
  • 134k
5 votes
Accepted

Affine plaintext attack with GCD != 1

You seem to have made a mistake in your arithmetic: $$108108 - 72097 = 36011 \ne 36012.$$ The number $36011$ is invertible modulo $256256$, and thus you can find $a$ and $b$ in a straightforward ...
user avatar
5 votes
Accepted

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

OK, to understand this issue, let's first recap how the affine cipher is defined: $$c=a\cdot x+b\bmod m$$ Note that the following holds: $a\cdot x+b=c\iff a\cdot x=c-b$, where you would calculate $-...
user avatar
  • 44.7k
3 votes

Formula for E(m) of the Atbash Cipher

The math goes: add the integer assigned to a, the integer assigned to z, and from that constant (which can be pre-computed) ...
user avatar
  • 125k
3 votes

Affine plaintext attack with GCD != 1

This can easily be solved by brute force. Start with the following relationships: $$72097a + b = 24328 \pmod{256256}$$ $$108108a + b = 164193 \pmod{256256}$$ then rearrange to obtain two expressions ...
user avatar
  • 2,013
3 votes

How is the affine cipher a permutation?

Multiplication by 2 modulo 26 is indeed not a permutation. For example, $$2 \times 13 = 26 \equiv 0 = 2 \times 0 \pmod{26}.$$ The necessary and sufficient criterion for the affine map $x \mapsto ax +...
user avatar
3 votes

How to attack polyalphabetic affine cipher with only ciphertext?

This is a simple variant of the Vigenère cipher, and can be broken in basically the same way: First, you need to determine the key length. The standard methods for doing this for any Vigenère-like ...
user avatar
3 votes
Accepted

Can all affine cyphers be expressed with this formula

$a\cdot x +b $ means affine not permutation. And $a\cdot x +b \bmod 26$ is modular affine transformation. $a\cdot x +b \bmod 26$ can have at most $26\cdot 26$ affine transformations some of which ...
user avatar
  • 43.5k
2 votes
Accepted

Affine cipher: calculate the key from a known plaintext/ciphertext pair

Given that you have parts of the plain text and its corresponding ciphertext, this is called a known plaintext attack. Given an affine cipher that has a key that is composed of 2 parts $a$ and $b$, ...
user avatar
  • 7,914
2 votes
Accepted

Affine Cipher - Greatest Common Divisor

If you want to find the multiplicative inverse of an integer a (mod n) you can use the extended Euclidean algorithm. For two integers a and b, the Extendend Euclidean Algorithm not only calculate the ...
user avatar
  • 128
2 votes
Accepted

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

There are several ways to break an affine cipher without any known plaintext. First of all, for the common case of $n = 26$, there are only $12$ possible values of $a$ (since $a$ and $n$ must be ...
user avatar
2 votes

How is the affine cipher a permutation?

If there was $x_1 \neq x_2$ in the ring of integers modulo $n$ such that $$ax_1+b \equiv a x_2+b \pmod n$$ subtracting the two sides would give $a(x_1-x_2) \mid n$ and since $\gcd(a,n)=1,$ this means $...
user avatar
  • 16.6k
2 votes

Have affine ciphers actually been used in practice?

While it's hard to prove that something has not been done, I'm fairly confident in asserting that affine ciphers (with $a \not\equiv \pm1$) are purely educational toys and have never been used for ...
user avatar
2 votes

Cracking affine cipher with plaintext

Remember when you solved systems of linear equations in school? This is essentially the same. You just swap out $K=\mathbb R$ for $K=\mathbb F_{601}$ which allows you to essentially do the same things ...
user avatar
  • 44.7k
2 votes
Accepted

Affine Cipher Keys that map plaintext to a given ciphertext

Assuming plaintext and ciphertext alphabets are $U=\{0,\ldots,25\}$, taken to be the ring of integers modulo 26, and the keyspace is $U^2$ with $$(a,b)\in U^2,$$ it is clear that for plaintext $x=2t$ ...
user avatar
  • 16.6k
2 votes

Affine Cipher Cryptanalysis

When working with modulo arithmetic, in case of trouble, get back at what the notation used truly leans. When the question correctly derives $18\,a+0=12$, that really is a shorthand for $18\,a+0\...
user avatar
  • 125k
1 vote

Linear subspace and Affine subspace

In general an affine subspace is not a subspace, it's just a translate (coset) of a subspace. This is because normally we expect $0$ to be in a subspace $V$, since due to closure $x-x \in V.$ If $a+V$...
user avatar
  • 16.6k
1 vote
Accepted

use of encryption of plain text from 1 instead of 0

No, you need to have a corresponding value for the letter $0$. Usual affine cipher schemes have the form $(a * x + b)$ $mod$ $k$ Let's say $a = 3$ and $b = 6$. If we would encrypt the letter $g$: $...
user avatar
  • 6,326
1 vote
Accepted

Stuck on an affine cipher exercise

If I'm reading your question right, you've made two simple math mistakes: The solution to $-1 \equiv -15a \pmod{26}$ isn't $a = 15$; it's $a \equiv 15^{-1} \pmod{26}$, or $a = 7$. I'm not sure where ...
user avatar
1 vote

Affine cipher of affine cipher, finding all possible values of a and b

Since this appears to be a homework exercise, I'll just give you a hint: write out the full expression for $e(e(e(x)))$. Note that the resulting expression will itself be an affine cipher, i.e. it ...
user avatar
1 vote

Affine Cipher - Pair of plain to cipher text

After $3a=-1 \pmod{26}$ note that mod $26$ we have $-1 = 25=51=3\cdot 17$, so $a=17$. Alternatively, note that $3\cdot9=27=1$ so we can multiply both sides by $3^{-1}=9$ and $-9=17\pmod{26}$. And ...
user avatar
1 vote

Affine Cipher formula for numbers

You can simply extend your "alphabet", so you would perform calculations modulus 26 + 10 = 36. For instance, if you did encode 'A' to the value 0 and 'Z' to the value 25 then the digit '0' would ...
user avatar
  • 85.9k
1 vote

Given alphabetic key and cipher text decrypt the cipher text

In general the key and ciphertext suffices, unless there are things missing such as an IV vector or other parameters. The trick is that you would still need to find the actual algorithm. Although ...
user avatar
  • 85.9k
1 vote

How does this affine cipher work?

W = 87; I = 73; S = 83; K = 75 This yields the ...
user avatar
  • 1,699
1 vote

Perfect secrecy of affine cipher

An encryption scheme is said to achieve perfect secrecy if for every probability distribution over M (the messsage space), every message m$\in$*M* and every ciphertext c$\in$C for which Pr[C = c]>0: ...
user avatar
  • 128
1 vote

Decrypt affine cipher given encryption key

Your formulas are wrong. If $$c \equiv 7p + 11 \mod{27}$$ then by applying the modular arithmetic function $$c - 11 \equiv 7 p \mod{27}$$ and then $$(c - 11) \times 7^{-1} \equiv p \mod{27}$$. ...
user avatar
  • 376

Only top scored, non community-wiki answers of a minimum length are eligible