The Feistel Cipher package can be used to implement a Feistel Cipher using either inbuilt or custom functions for encyrpting and decrypting integers.
Current Version: 0.2.0
Requires: Python 3.5+
The creation of the package is both inspired by and based on the explanation given Dr. Mike Pound on the Computerphile YouTube channel in the video titled Feistel Cipher - Computerphile.
You can install the Feistel Cipher package from PyPI
pip install feistelcipher
import feistelcipher.FeistelCipher as fc
import feistelcipher.CryptFunctions as cfs
import feistelcipher.StandardCryptFunctions as scf
funcList = cfs.CryptFunctions()
funcList.addFunc(scf.strLength)
funcList.addFunc(scf.quotient, [7])
funcList.addFunc(scf.power, [3])
funcList.addFunc(scf.truncate, [5])
funcList.addFunc(scf.scaledDistance, [1, 2, 3, 4])
cipher = fc.FeistelCipher(funcList)
enc = cipher.encrypt(1_234_567)
print(repr(enc))
>>> EncryptedObject(437201434, 43067, 4)
dec = cipher.decrypt(enc)
print(dec)
>>> 1234567
For detailed explanation and usage of this package with custom functions, kindly refer to Examples.ipynb in the GitHub repo.
- Support for Keyword arguments
- Encrypting/Decrypting iterables of integers
- Support for easily saving the
FeistelCipher
object to a pickled or binary file - Improved Documentation
If you liked this package or found it useful, consider starring the associated GitHub repository.
Created by - Mayur Kr. Garg