Decrypting an Affine Cipher with Modulus

829 Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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.