Simple, reusable and optimized XOR ciphers in Python.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44df295f4894a802f6470baff67930032d563c2fc41f50a6c074aae1f822cee4
|
|
| MD5 |
64725cc5a774509785467bd5f68ce5b0
|
|
| BLAKE2b-256 |
0b9b17d98efe09b78b64953eecd07418d7ca4746d3e9b21227f456dc6eafe7ce
|
Provenance
The following attestation bundles were made for xor_cipher-5.0.2.tar.gz:
Publisher:
release.yml on GDPSApp/xor-cipher-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xor_cipher-5.0.2.tar.gz -
Subject digest:
44df295f4894a802f6470baff67930032d563c2fc41f50a6c074aae1f822cee4 - Sigstore transparency entry: 237201022
- Sigstore integration time:
-
Permalink:
GDPSApp/xor-cipher-python@956eb5bd95919ec510fa9c21edf1d77654d63100 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GDPSApp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@956eb5bd95919ec510fa9c21edf1d77654d63100 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a295ea8aecb2b48169308af6ad6b31ce772c8a95015e68fbe57dc7caef48d868
|
|
| MD5 |
fb031072db27ae552f76c6385902b3e5
|
|
| BLAKE2b-256 |
8070baf806be7d8340badfa20c474f0e017a26b1d142dfb2f4ec79cd9619a5ca
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xor_cipher-5.0.2-py3-none-any.whl -
Subject digest:
a295ea8aecb2b48169308af6ad6b31ce772c8a95015e68fbe57dc7caef48d868 - Sigstore transparency entry: 237201023
- Sigstore integration time:
-
Permalink:
GDPSApp/xor-cipher-python@956eb5bd95919ec510fa9c21edf1d77654d63100 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GDPSApp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@956eb5bd95919ec510fa9c21edf1d77654d63100 -
Trigger Event:
workflow_dispatch
-
Statement type: