xor-cipher
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.
Release files for xor-cipher 5.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xor_cipher-5.0.2.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xor_cipher-5.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / xor_cipher-5.0.2.tar.gz
| Download URL | xor_cipher-5.0.2.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44df295f4894a802f6470baff67930032d563c2fc41f50a6c074aae1f822cee4
|
|
BLAKE2b-256 checksum How to use checksums |
0b9b17d98efe09b78b64953eecd07418d7ca4746d3e9b21227f456dc6eafe7ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 13, 2025.
Transparency logRelease files / xor_cipher-5.0.2-py3-none-any.whl
| Download URL | xor_cipher-5.0.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a295ea8aecb2b48169308af6ad6b31ce772c8a95015e68fbe57dc7caef48d868
|
|
BLAKE2b-256 checksum How to use checksums |
8070baf806be7d8340badfa20c474f0e017a26b1d142dfb2f4ec79cd9619a5ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 13, 2025.
Transparency log