Question: AFFINE ( LINEAR ) CIPHER: Affine cipher, also known as linear cipher, is a geometric encryption method. y = a x + b Here, x

AFFINE (LINEAR) CIPHER:
Affine cipher, also known as linear cipher, is a geometric encryption method.
y=ax+b
Here, x is the text to be encrypted and (a,b) are the key values.
Encryption:
Step 1: All characters of the text to be encrypted are converted to their corresponding values in the alphabet. For example, if we use the English alphabet, we should use values from 0 to 25.A0,B1,C2,D3,E4, etc.
Step 2: For each value, apply the operation E(x)=(ax+b)modn. Here, n is the number of characters in the alphabet. For instance, for the English alphabet, n is chosen as 26.
Step 3: The result of each value produced by the function is written as a character corresponding to that value in the alphabet.
Decryption:
Step 1: The encrypted text is broken down into individual characters, and the position of each character in the alphabet is determined.
Step 2: Find the appropriate value of z for which a.zmodn=1. Here, the value of "a" was initially provided as a key.
Step 3: After finding the appropriate z value, apply the operation D(x)=z(y-b)modn to each value.
Step 4: Find the corresponding character in the alphabet for each value, and the encrypted message is decrypted.
NOTE: For this method to work correctly, "a" and "n" must be coprime. For this reason, for an alphabet with 29 characters, there are 29**28=812 possible keys.
AFFINE ( LINEAR ) CIPHER: Affine cipher, also

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!