By ARYA SARKAR
This is a Python program using which you can encrypt and decrypt a file using the Affine Cipher which will help to secure your confidential data.
Requirements:-
To run this code following libraries should be installed:-
1. SymPy -> This library is used for symbolic Mathematics and in this project will help to get prime numbers within a range using only the library package
Code Instruction:-
1. You can Provide the FILE path or File Name (but remember that file should be in the same directory)
2. The File Should end with the extension (Recommend to use a .txt file)
3. After that provide any number
4. Then You will get Your encrypted and Decrypted Text
How is Affine Encryption & Decryption Working:
In Affine Ciphering we use the combination of Multiplicative Cipher and Caesar Cipher algorithm.
Encryption:
It uses modular arithmetic to transform the integer that each plaintext letter corresponds to into another integer that correspond to a ciphertext letter. The encryption function for a single letter is
E(X) = (ax+b)mod m
modulus m: Weight of Alphabet
a and b: Cipher Key
Decryption
In deciphering the ciphertext, we must perform the opposite functions on the ciphertext to retrieve the plaintext.In this we convert each of the encrypted text into integer values. The decryption function is
D (x) = a^-1(x-b)mod m a^-1 : modular multiplicative inverse of a modulo m. 1 = a a^-1 mod m .
Submitted by ARYA SARKAR (arya08124)
Download packets of source code on Coders Packet
Comments