Skip to main content

Bindings for the Twofish implementation by Niels Ferguson libtwofish-dev.

Compatible with Python 2.6, 2.7 and 3.3.

The library performs a self-test at each import.

Installation

pip install twofish

Usage

Create a twofish.Twofish instance with a key of length ]0, 32] and then use the encrypt and decrypt methods on 16 bytes blocks.

All values must be binary strings (str on Python 2, bytes on Python 3)

[WARNING] this should be used in a senseful cipher mode, like CTR or CBC. If you don’t know what this mean, you should probably usa a higher level library.

Example

>>> from twofish import Twofish
>>> T = Twofish(b'*secret*')
>>> x = T.encrypt(b'YELLOWSUBMARINES')
>>> print(T.decrypt(x).decode())
YELLOWSUBMARINES

Release files for twofish 0.3.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 twofish 0.3.0
File Size Uploaded
twofish-0.3.0.tar.gz 26.0 kB Details

Release files / twofish-0.3.0.tar.gz

Download URL twofish-0.3.0.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b09d8bb50d33b23ff34cafb1f9209f858f752935c6a5c901efb92a41acb830fa
BLAKE2b-256 checksum
How to use checksums
82b49eb026a8e62a04512435d3de25c93f7bda51c8b8c7991c1c0be70b5115a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

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