1
$\begingroup$

Suppose I have a ciphertext that I know is encrypted using an affine cipher in $\mathbb{Z}_{26}$. The plaintext begins with es and the corresponding ciphertext is FX. How can I calculate the key?

$\endgroup$

1 Answer 1

2
$\begingroup$

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$, you can express it as a system of 2 equations with 2 unknown. Assuming the usual mapping $\mathtt{a} \to 0$, $\mathtt{b} \to 1$, etc., you need to solve the following system of linear equations: $$\left\{ \begin{array}{l} 4a+b = 5 \\ 18a+b = 23 \end{array}\right.$$ where the encryption function is $x \mapsto ax+b$. Solve it exactly as you would in $\mathbf{R}$, just be careful when dividing.

$\endgroup$

Your Answer

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

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