Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

cryptanalib3

cryptanalib3 is a Python3 fork of the cryptanalib module from the FeatherDuster project, meant to be a standalone module for performing cryptanalysis and cryptographic exploit development.

Since Python3 forces a choice between bytes and string objects, cryptanalib3 now operates entirely on bytes objects in order to avoid the various ways in which Python manipulates strings to try to ensure the data is readable in the user's locale. All functions that consumed and return strings in the original Cryptanalib now receive and return bytes objects.

Usage

To use cryptanalib3, launch Python3 and import ca3. Since Python's built-in help() doesn't do a very good job of showing function prototypes with complex default values, there is a show_help() function provided that addresses this shortcoming and functions more or less identically to the built-in help(). You can use this function to explore the functions provided by the module, like so:

Using cryptanalib3 help

Cryptanalib3 can attempt to decode, identify, and look for indicators of vulnerability with the analyze_ciphertext() function:

Analyzing ciphertext

Here is an example of generating ciphertext from a script that will give us a flag encrypted with AES-CTR using a fixed nonce, as well as encrypting any value we like using the fixed nonce. We first use the analyze_ciphertext() function to determine that the ciphertext is generated with a stream cipher, and that there are signs that the key may be reused, indicated by the key_reuse keyword returned by the analysis. This means we can launch a known plaintext attack against the ciphertext, calculating the keystream by XORing together any corresponding known plaintext and ciphertext. We encrypt a long string of aaaa..., then XOR it with its encrypted version. We then XOR the keystream with the encrypted flag, decrypting it:

An attack on AES-CTR with fixed nonce

Metadata

Release files for cryptanalib3 1.0.0b0

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

Source distribution (sdist)

Source distribution for cryptanalib3 1.0.0b0
File Size Uploaded Provenance Actions
cryptanalib3-1.0.0b0.tar.gz 139.2 kB Without provenance Details for cryptanalib3-1.0.0b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cryptanalib3 1.0.0b0
File Interpreter ABI Platform Actions
cryptanalib3-1.0.0b0-py3-none-any.whl Python 3 none any Details for cryptanalib3-1.0.0b0-py3-none-any.whl

Total release size: 277.8 kB

Release files / cryptanalib3-1.0.0b0.tar.gz

Download URL cryptanalib3-1.0.0b0.tar.gz
Size 139.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c318fc6f178d9d4ea26e0ba91f2cb97db40c2a8d349dff7c16c6c9a76a1506ca
BLAKE2b-256 checksum
How to use checksums
4eff5a5fd28603f5d3b10715bceb3e48004d9df35b759cf8c9c883ed5b595388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

Release files / cryptanalib3-1.0.0b0-py3-none-any.whl

Download URL cryptanalib3-1.0.0b0-py3-none-any.whl
Size 138.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25d2e6d24e71d0c6e4b542c6e8d5e4e71e9a6b041cda482adfaaacdba706908f
BLAKE2b-256 checksum
How to use checksums
4b525210ed96483d294d3fa3996fc8a747814ba6e19d94ced98ab69c083e21aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

Security for cryptanalib3 1.0.0b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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