Introduction to Cryptography Lecture 3
Affine Cipher
Encrypting with Affine Cipher
- Monoalphabetic substitution cipher
- Example encryption:
- is the size of the alphabet array.
- For simplicity, we use alphabets where .
- and are keys of the cipher.
- must be chosen such that and are coprime.
- is the size of the alphabet array.
- Decryption involves a different inverse logic.
Decrypting with Affine Cipher
- Decryption formula:
Where:
- is the encrypted character.
- is the modular multiplicative inverse of modulo .
- is the key used for shifting.
- is the size of the alphabet (e.g., for the English alphabet).
Steps for Decryption
- Find Modular Inverse: Ensure and are coprime, then calculate using the Extended Euclidean Algorithm.
- Apply the Formula: Subtract from the encrypted value , multiply by , and reduce modulo .
Example
Assume , , and : Encrypted character : 15 (corresponds to ‘P’).
-
Find :
-
Decrypt using the formula:
So, the decrypted character corresponds to 17 (which is ‘R’).
Questions
Question 1
Suppose is a key in a cipher over mod 26. It should follow the form: where (integers).
Answer 1
Step 1: Understand the form
We are given:
- , where:
- (multiplicative key),
- (additive key),
- (modulus for the alphabet size).
The decryption formula is:
Here:
- is the modular inverse of modulo .
- shifts the encrypted character back using .
Step 2: Find (modular inverse of )
We need such that:
Using the Extended Euclidean Algorithm, find modulo 26:
- (as ).
Step 3: Substitute values into the formula
Replace and into the formula:
Step 4: Simplify the formula
Expand and simplify:
- Distribute :
- Calculate :
- Substitute back:
To match the form :
- ,
- .
Final Answer:
The decryption formula is: where:
- ,
- .
Question 2
is used to encrypt a plaintext. Find the decryption function . If the Affine Cipher yields the following cipher text find the corresponding plaintext NAXT.
Answer 2
Here, 3 and 10 are and .