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 can be brute forced. That's what I think, and I have read about Vigenère over a Vigenère, so practically they would be the same case, right?

  • 1
    $\begingroup$ Well, the key sizes must be different. Otherwise, you can reduce the cascade to one invocation of the base cipher (talking about Vigenère). $\endgroup$
    – Artjom B.
    Commented Jan 13, 2016 at 11:54
  • 6
    $\begingroup$ Even if the key sizes are different, it reduces to a single Vigenère with a longer key (whose length is the LCM of the lengths of the two keys). $\endgroup$
    – fkraiem
    Commented Jan 13, 2016 at 12:11

1 Answer 1


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+(a_1b_2+b_1)$.

Note that if $a_1$ and $a_2$ are both relatively prime with the modulus, then so is $a_1a_2$, so the new cipher can also be deciphered.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.