1
$\begingroup$

I'm trying to decrypt the ciphertext vczkh which I know was encoded using an affine cipher with the equation 7x + 8(mod 26). This makes my decryption function p = (c – b) * a^-1 (mod 26) where b = 8, a = 7, c = number corresponding with cipher character starting from 0, and p is the same for plaintext. Since I can't have a fraction I calculated that 11 is congruent to 7 making my function p = (c - 8) * 11. Running this for all five letters gives me NMFWP but I know the answer is supposed to be NOVEL. I do not know what I'm doing wrong.

$\endgroup$
  • $\begingroup$ "11 is congruent to 7"??? $\endgroup$ – Gerry Myerson Jan 28 '15 at 2:06
  • $\begingroup$ Is it not? 7 * 11 = 77 and 77 % 26 = 1. That means congruence right? $\endgroup$ – Nick Gilbert Jan 28 '15 at 2:07
  • $\begingroup$ "$a$ is congruent to $b$ modulo $c$" means $a-b$ is a multiple of $c$. Is $11-7$ a multiple of 26? $\endgroup$ – Gerry Myerson Jan 28 '15 at 2:09
  • $\begingroup$ 77 divided by 26 leaves a remainder 1? $\endgroup$ – Gerry Myerson Jan 28 '15 at 2:09
  • $\begingroup$ Never mind it's 15 $\endgroup$ – Nick Gilbert Jan 28 '15 at 2:16
1
$\begingroup$

We have:

$$y = ax + b \pmod {26} = 7x + 8 \pmod {26}$$

The inverse operation is given by:

$$x = \dfrac 1a (y - b) \pmod {26} = \dfrac{1}{7}(y - 8) \pmod {26} = 15(y-8) \pmod{26}$$

We are looking for a modular inverse (see the discussion on the Extended Euclidean algorithm) and you were slightly off on that. Try it using this online calculator. You get:

$$\dfrac{1}{7} \pmod{26} = 7^{-1} \pmod{26} = 15 \pmod {26}$$

I think you can take it from here.

$\endgroup$
  • $\begingroup$ $11\times15=165=6\times26+9$. $\endgroup$ – Gerry Myerson Jan 28 '15 at 2:07
  • 1
    $\begingroup$ Thanks @GerryMyerson, just transcribed it wrong - corrected! $\endgroup$ – Amzoti Jan 28 '15 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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