Skip to main content

xor_bytes and crc32 are implemented in C against the CPython Stable ABI (abi3), so a single wheel (cp38-abi3) works on CPython 3.8 and newer; pure-Python fallbacks are used automatically when the extension is unavailable (e.g. on PyPy). Everything else is pure Python.

Installation

pip install basic-crypt

Usage

import basic_crypt as bc

bc.xor_bytes(b"attack at dawn", b"key")            # b'\x1b\x00\x15\x06j...'
bc.xor_bytes(bc.xor_bytes(b"secret", b"k"), b"k")  # b'secret'
bc.crc32(b"123456789")                             # 3421780262 (0xCBF43926)

bc.rot13("Hello, World!")                          # 'Uryyb, Jbeyq!'
bc.atbash("Hello")                                 # 'Svool'
bc.affine_encrypt("AFFINE", 5, 8)                  # 'IHHWVC'
bc.affine_decrypt("IHHWVC", 5, 8)                  # 'AFFINE'
bc.railfence_encrypt("WEAREDISCOVEREDFLEEATONCE", 3)
bc.railfence_decrypt("WECRLTEERDSOEEFEAOCAIVDEN", 3)
bc.rc4(b"Plaintext", b"Key").hex()                 # 'bbf316e8d940af0ad3'

basic_crypt.native_available() reports whether the compiled _native extension is in use.

API reference

Function Description
xor_bytes(data, key) Repeating-key XOR over any bytes-like objects
crc32(data) zlib-compatible CRC-32 checksum (IEEE 802.3) as int
rot13(text) ROT13 substitution on letters
atbash(text) Atbash (A↔Z) substitution on letters
affine_encrypt(text, a, b) Affine cipher; requires gcd(a, 26) == 1
affine_decrypt(text, a, b) Inverse of affine_encrypt
railfence_encrypt(text, rails) Rail fence transposition
railfence_decrypt(text, rails) Inverse of railfence_encrypt
rc4(data, key) RC4 stream cipher (symmetric)
native_available() True if the compiled abi3 extension is in use

License

MIT — see LICENSE.

Metadata

Release files for basic-crypt 1.5.3

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

Source distribution (sdist)

Source distribution for basic-crypt 1.5.3
File Size Uploaded Provenance Actions
basic_crypt-1.5.3.tar.gz 7.7 kB Without provenance Details for basic_crypt-1.5.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for basic-crypt 1.5.3
File Interpreter ABI Platform Actions
basic_crypt-1.5.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for basic_crypt-1.5.3-py3-none-win_amd64.whl
basic_crypt-1.5.3-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details for basic_crypt-1.5.3-py3-none-manylinux1_x86_64.whl

Total release size: 178.0 kB

Release files / basic_crypt-1.5.3.tar.gz

Download URL basic_crypt-1.5.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a1a30a419699cbdf2b7009f2d82f9f4552c0a6e0eb0068cca36fbf51d9a101b2
BLAKE2b-256 checksum
How to use checksums
82200d7e9ef75ca3ffbcaf8d84909a80c4f71e09143ab8a832ff92a505d89a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / basic_crypt-1.5.3-py3-none-win_amd64.whl

Download URL basic_crypt-1.5.3-py3-none-win_amd64.whl
Size 131.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
8dc0fb628fe30146413c46cdad56f9233f43236129d4ccc8ba03b1814300d29e
BLAKE2b-256 checksum
How to use checksums
04076c4599df6861cc690c3d29cf28ab1cfd1cf08ac86ddc2a661032e8353620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / basic_crypt-1.5.3-py3-none-manylinux1_x86_64.whl

Download URL basic_crypt-1.5.3-py3-none-manylinux1_x86_64.whl
Size 39.1 kB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a27b99b6c79a087b5cdf89559f84fb53ca02fa25352ed3112e25e4257346f55d
BLAKE2b-256 checksum
How to use checksums
aa79cfef1b1a26cf6eb94bf39bfc85ffd1436ea5a8fbc0ff164edfc15642b4db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for basic-crypt 1.5.3

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.

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