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.4

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

Built distribution (wheel)

Table of built distributions (wheels) for basic-crypt 1.5.4
File Interpreter ABI Platform Actions
basic_crypt-1.5.4-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for basic_crypt-1.5.4-py3-none-macosx_14_0_arm64.whl

Release files / basic_crypt-1.5.4-py3-none-macosx_14_0_arm64.whl

Download URL basic_crypt-1.5.4-py3-none-macosx_14_0_arm64.whl
Size 18.1 kB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
c6e4832096feccfcfc79da180dfcac972be05b53778c46cf10465057cf78c046
BLAKE2b-256 checksum
How to use checksums
7f697093a2eb3560fba9f19d278b11c63ee3bfd9c49bdf4c4fe1619553e3ff00
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.4

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