Skip to main content

Feistel Cipher

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+

Inspiration

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.

Installation

You can install the Feistel Cipher package from PyPI

pip install feistelcipher

Usage

Import the necessary classes

import feistelcipher.FeistelCipher as fc
import feistelcipher.CryptFunctions as cfs
import feistelcipher.StandardCryptFunctions as scf

Create a CryptFunctions object

funcList = cfs.CryptFunctions()

Add functions and associated keys to the CryptFunctions object

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])

Create a FeistelCipher object using the CryptFunctions object

cipher = fc.FeistelCipher(funcList)

Encryption

enc = cipher.encrypt(1_234_567)
print(repr(enc))
Output
>>> EncryptedObject(437201434, 43067, 4)

Decryption

dec = cipher.decrypt(enc)
print(dec)
Output
>>> 1234567

Advanced Usage and Explanation

For detailed explanation and usage of this package with custom functions, kindly refer to Examples.ipynb in the GitHub repo.

Upcoming improvements

  • Support for Keyword arguments
  • Encrypting/Decrypting iterables of integers
  • Support for easily saving the FeistelCipher object to a pickled or binary file
  • Improved Documentation

Thank You

If you liked this package or found it useful, consider starring the associated GitHub repository.

Created by - Mayur Kr. Garg

Release files for feistelcipher 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for feistelcipher 0.2.0
File Size Uploaded
feistelcipher-0.2.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for feistelcipher 0.2.0
File Interpreter ABI Platform
feistelcipher-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / feistelcipher-0.2.0.tar.gz

Download URL feistelcipher-0.2.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bd80f164b6733f2ec911ebb45fb225d76a527c563b913eebd5761bfc90a2d126
BLAKE2b-256 checksum
How to use checksums
e793c0fd150050b0ba1b2a76a65bea353b525916d72a74e5b03a627fbe47bd89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

Release files / feistelcipher-0.2.0-py3-none-any.whl

Download URL feistelcipher-0.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
650e54db96067f336f2ac2ca6d5ec62132008705fedeb97a7fa66f65c4c9a72c
BLAKE2b-256 checksum
How to use checksums
db8b3832598f445d4522b1a78b438e9cc209513e3de1631ee6254092b1b2513c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page