Tuesday, May 11, 2021

ENCRYPTION METHOD 3- AFFINE CIPHER

 

* This encryption is made entirely according to mathematical calculations.

* We will see in a moment  how functions and modular arithmetic in           particular are used for this encryption.

* This encryption type which was used at various times in the past, is also       the basic of today's encryption.

Curriculum topics related to Affine Cipher/ Aim : Linear functionsmodular arithmetic, prime numbers, composite numbers, between prime numbers,divisibility, common divisors

EXAMPLE

ENCRYPTION

Encryption is done according to a linear function 

 f(x)=ax+b (mod m)

* m is the number of letters in the alphabet used.

*  and b constans are the keys to the cipher. 

* x is the number represented by the letter in plain text.

* f (x) is the value that creates the encrypted text.

* mod  is moduler arithmetic.

For example, let's convert the plain text "AFFINE CIPHER" in to ciphertext according to the key (a, b) = (5,8). Let's give numbers to letters, starting from 0 first.

PlainAlphabetABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherAlphabet012345678910111213141516171819202122232425

 

Now, we will find the value of the   A,F,I,N,C,P,H,E,R letters  according to

f(x)=5x+8 (mod 26)  function. 

For example we can make for "N" 

N=13

f(13)=5.13+8=73 

73=21 (mod 26),  (The remainder from the division of 73 with 26 is 21)

f(13)=21 (mod 26)

21= V

So, the letter N in plain text corresponds to the letter V in cipher text. If the values ​​corresponding to the other letters are found one by one, the following table is obtained.

PlaintextAFFINE CIPHER
x0558134 28157417
5x+883333487328 184883432893
5x+8 (mod 26)87722212 1822517215
CiphertextIHHWVC SWFRCP

 

Then you can find ciphertext IHHWVC SWFRCP.

Method: Affine cipher, Key=(5,8), Plaintext=AFFINE CIPHER, Ciphertext= IHHWVC SWFRCP.

DECRYPTION

If we want to decrypt the ciphertext  "IHHWVC SWFRCP"

 We have to do the reverse transaction. f (x), inverse of the function

f-1 (x) = (x-8) / 5

We need to find the equivalent of this function in mod 26 . To remove the denominator, we need to expand the fraction by a number to make the denominator 1 in mod 26. This number is 21.

f-1 (x) = 21. (x-8) / 21.5 

          = 21 (x-5) / 105 

           = 21 (x-8) /1

           = 21 (x-8)

 f-1 (x) = 21 (x-8), (mod 26)

So we will use is this function  for decryption. Let's decrypt IHHWVC SWFRCP with this function.

For example, we can do for letter "C"

C=2

f-1 (x) = 21 (x-8)     

f-1 (2) = 21 (2-8)

           = - 126

To find the equivalent of -126 in (mod 26) we need to add a multiple of 26.

-126 + 5.26 = -126 + 130 = + 4 = E

So, the letter C in cipher text corresponds to the letter E in plain text . If the values ​​corresponding to the other letters are found one by one, the following table is obtained.

 

PlaintextIHHWVC SWFRCP
x87722212 1822517215
21(x-8)0-21-21294273-126 210294-63189-126147
21(x-8)  (mod 26)0558134 28157417
CiphertextAFFINE CIPHER

No comments:

Post a Comment

THIRD QUALITY LABEL FROM FRENCH GUIANA

  Magali Kervennic   and Lycee Balata  students have been  awarded the Quality Label  by the  French National  Support  Service.  Congratula...