Skip to main content

Simple, reusable and optimized XOR ciphers in Python.

Project description

xor-cipher

License Version Downloads

Documentation Check Test Coverage

Simple, reusable and optimized XOR ciphers in Python.

xor-cipher is a fast implementation of the XOR cipher written using Rust. Our tests show that it can be 1000x faster than pure Python implementations. It has been optimized to breeze through datasets of any size.

Installing

Python 3.9 or above is required.

pip

Installing the library with pip is quite simple:

$ pip install xor-cipher

Alternatively, the library can be installed from source:

$ pip install git+https://github.com/GDPSApp/xor-cipher-python.git

Or via cloning the repository:

$ git clone https://github.com/GDPSApp/xor-cipher-python.git
$ cd xor-cipher-python
$ pip install .

uv

You can add xor-cipher as a dependency with the following command:

$ uv add xor-cipher

Examples

Simple Cipher

Use the xor function to perform the simple XOR cipher:

>>> from xor_cipher import xor
>>> xor(b"Hello, world!", 0x42)
b"\n'..-nb5-0.&c"

Cyclic Cipher

Use the cyclic_xor function to perform the cyclic XOR variation:

>>> from xor_cipher import cyclic_xor
>>> cyclic_xor(b"Hello, world!", b"BLOB")
b"\n)#.-`o5->#&c"

In-Place Cipher

There are functions to perform the XOR cipher in-place, on bytearray instances:

>>> from xor_cipher import xor_in_place
>>> data = bytearray(b"Hello, world!")
>>> xor_in_place(data, 0x42)
>>> data
bytearray(b"\n'..-nb5-0.&c")

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of xor-cipher here.

Contributing

If you are interested in contributing to xor-cipher, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

xor-cipher is licensed under the MIT License terms. See License for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xor_cipher-5.0.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xor_cipher-5.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file xor_cipher-5.0.2.tar.gz.

File metadata

  • Download URL: xor_cipher-5.0.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xor_cipher-5.0.2.tar.gz
Algorithm Hash digest
SHA256 44df295f4894a802f6470baff67930032d563c2fc41f50a6c074aae1f822cee4
MD5 64725cc5a774509785467bd5f68ce5b0
BLAKE2b-256 0b9b17d98efe09b78b64953eecd07418d7ca4746d3e9b21227f456dc6eafe7ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for xor_cipher-5.0.2.tar.gz:

Publisher: release.yml on GDPSApp/xor-cipher-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xor_cipher-5.0.2-py3-none-any.whl.

File metadata

  • Download URL: xor_cipher-5.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xor_cipher-5.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a295ea8aecb2b48169308af6ad6b31ce772c8a95015e68fbe57dc7caef48d868
MD5 fb031072db27ae552f76c6385902b3e5
BLAKE2b-256 8070baf806be7d8340badfa20c474f0e017a26b1d142dfb2f4ec79cd9619a5ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for xor_cipher-5.0.2-py3-none-any.whl:

Publisher: release.yml on GDPSApp/xor-cipher-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page