1. ## affine cipher

A plaintext letter is left fixed by a cipher if it remains the same in the ciphertext generated by the cipher. Find the letters left fixed by each affine cipher.

a) c = 5P+11(mod26)

b) c = 5P+14(mod26)

thank you.

2. If a letter is left fixed, can you write down an equation that represents that fact?

3. ans.
a) no letter left fixed
b) D and Q

???

4. I understand those are the answers, but you didn't do what I asked. You gotta think this out! Can you write down an equation that represents the concept of one of those affine ciphers leaving a letter fixed? What does "leaving a letter fixed" mean?

5. ok.
What does "leaving a letter fixed" mean?
ans. plaintext letter=ciphertext letter although the plaintext letter is encrypted.

6. Correct. By your png's, it looks like you've pretty much solved the problem, although such a brute-force approach isn't going to explain why the second cipher leaves two letters fixed, and the first cipher doesn't leave any letters fixed. You'd need some number theory to figure that out.

7. Explain why the second cipher leaves two letters fixed, and the first cipher doesn't leave any letters fixed.

a) 5p + 11 = p (mod 26)
4p = -11 (mod 26)
Since 4 and 26 are both even, adding any number of 26's
to -11 will never produce a multiple of 4, so there are no fixed points
in this one.

b)
5p + 14 = p (mod 26)
4p + 14 = 0 (mod 26)
4p = -14 (mod 26)
4p = (-14+26) = 12 (mod 26)
p = 3

To 12, we can add 26, but 38 not divisible by 4.
Adding another 26, we get 4p = 64, which gives p = 16.
Adding two more 26's we get 4p = 116, but then p = 29 which is > 26, so we are done.

Cryptanalyze the ciphertext created by an affine cipher c=ap+k(mod26) :
IRCCH EKKEV CLLFK EIOKL XKKLF ILIGM EKOIV EKKE

I would like to use the most frequently occuring letters in the ciphertext correspond to those in the plaintext but i can't find correct key. guess so dificult
I want to find key by method at above,then solve equation to find a and k by linear congruence.
Do you have techniques for guess?

now I get correct key C=7p+8(mod26) because I try to shift ordinal No.03,05,07,09,11,15,17,19,21,23,25 for a, and shift ordinal No.00 through 25for k. it must spend very long time for finding. --"

9. Reply to post # 7: I think the fixed points are going to be related to whether gcd(k,26) = 1 or not. If it is relatively prime, then I think you're going to see that there are no fixed points. That's my hunch, completely unproven. If gcd(a,26) is not equal to 1, then your cipher isn't going to work very well, since I don't think it's a bijection. So how would you prove this?

Set p = a p + k (mod 26). Then p (1-a) = k (mod 26). Under what conditions can this equation be satisfied? (I don't actually know the answer off the top of my head - it's been a while since I did number theory.) In your original problem a), you've got p (1-5) = 11 (mod 26). Now, -4 = 22 (mod 26). Hence, we'd have to solve 22 p = 11 (mod 26). The LHS is even, and the RHS is odd. Is that enough to guarantee the non-existence of solutions?

On the other hand, with problem a), you've got 22 p = 14 (mod 26). It strikes me that you might be able to find a solution to that, even though I don't think 22 has an inverse mod 26. In fact, you should be able to find exactly two solutions.

Reply to post # 8: A frequency analysis is never a bad idea. E, T, and A, in that order, are the most common letters in English. If you can find the E and the T correctly, that should be enough to get your a and k in the affine cipher formula. You'd just have a system of two equations in two unknowns.

The frequencies of your letters are:

I = 5
R = 1
C = 3
H = 1
E = 6
K = 9
V = 2
L = 5
F = 2
O = 2
X = 1
G = 1
M = 1.

So you'd probably assume that the K cipher = E plain, and that E cipher = T plain. Going with that assumption, what two equations do you get?

10. Originally Posted by Ackbeet

So you'd probably assume that the K cipher = E plain, and that E cipher = T plain. Going with that assumption, what two equations do you get?
i understand.
i did. i found it's not. i shown in attachment

but correct key that i found is the K cipher = E plain, and that I cipher = A plain

Ususlly the first letter is K and second letter is E follow that you said.
But this problem,the first letter is K and second letter is I. how i will know?

or i try to guess must go on until i found correct key.

11. But this problem,the first letter is K and second letter is I. how i will know?
You won't know ahead of time. In fact, ahead of time, you usually won't even know that the cipher is an affine cipher! You can usually guess that the cipher is a letter-by-letter substitution, by using various statistical analyses.

Statistically, the more letters you have in the ciphertext (assuming the plaintext language is English), the more certain you can be that the highest occurring letters will show up in their correct locations in the frequency order. This is not a very long ciphertext, so I wouldn't necessarily expect everything to be in textbook order.

Using the cipher you found, what is the plaintext?

12. the plaintext is " A FOOL SEES NOT THE SAME TREE THAT A WISE MAN SEES".

13. Good stuff! Is there anything unclear to you concerning this problem?

14. my last question.

Do I understand it correct? If incorrect,please tell me about correct problem-solving.

Thank you very much.

15. Your computations seem correct to me. The only question I would have is what the word "product" means there. Does it just mean the output of each cipher, separately? Or does it mean you apply one cipher, and then compose it with the other? Composition seems an unlikely interpretation, because the composition of two affine ciphers is itself affine. You wouldn't gain a stronger cipher that way, and you might even weaken the cipher.