Practical Cryptology Affine Cipher Summary and Cryptanalysis Encryption: C ( AP + B ) (mod 26) Decryption: P (A-1 (C B )(mod 26) – Conditions: A is relatively prime to 26: GCD (A, 26) = 1 B any number between 0 and 25 Cryptanalysis based on two known plaintext letters known plaintext attack – Suppose you know the cipher text, C1C2C3….CN and you know two plaintext letters, for simplicity, suppose that you know P1 and P2 that corresponds to the C1 and C2. Based on this information, in certain situations you will be able to find the keys of the Affine Cipher: A and B. Method of finding A and B: Substitute C1, C2, P1 and P2 intro encryption formula: (AP1 C1 + B)(mod 26) C2 (AP2 + B)(mod 26) To solve this system, use the following steps: Step 1 - Finding D using the formula below: D (P1 P2)(mod 26) – Pay Attention! D should be relatively prime to 26, in order to the system to have a unique solution. If D is not relatively prime you would not be able to find the keys based on the pair of the plaintext that you have. D-1 Step 2 Finding multiplicative inverse of D mod 26 – – If D is relative prime to 26, find D-1 multiplicative inverse of D mod 26 – D*D-1 1 (mod 26) Step 3 Finding keys A and B using formulas below: –
Practical Cryptology Affine Cipher Summary and Cryptanalysis Encryption: C ( AP + B ) (mod 26) Decryption: P (A-1 (C – B )(mod 26) Conditions: A is relatively prime to 26: GCD (A, 26) = 1 B any number between 0 and 25 Cryptanalysis based on two known plaintext letters – known plaintext attack Suppose you know the cipher text, C1C2C3….CN and you know two plaintext letters, for simplicity, suppose that you know P1 and P2 that corresponds to the C1 and C2. Based on this information, in certain situations you will be able to find the keys of the Affine Cipher: A and B. Method of finding A and B: Substitute C1, C2, P1 and P2 intro encryption formula: C1 (AP1 + B)(mod 26) C2 (AP2 + B)(mod 26) To solve this system, use the following steps: Step 1 - Finding D using the formula below: D (P1 – P2)(mod 26) Pay Attention! D should be relatively prime to 26, in order to the system to have a unique solution. If D is not relatively prime you would not be able to find the keys based on the pair of the plaintext that you have. Step 2 – Finding D-1 – multiplicative inverse of D mod 26 If D is relative prime to 26, find D-1 – multiplicative inverse of D mod 26 D*D-1 1 (mod 26) Step 3 – Finding keys A and B using formulas below: