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.8 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/xor-cipher/xor-cipher.git
Or via cloning the repository:
$ git clone https://github.com/xor-cipher/xor-cipher.git
$ cd xor-cipher
$ pip install .
poetry
You can add xor-cipher
as a dependency with the following command:
$ poetry add xor-cipher
Or by directly specifying it in the configuration like so:
[tool.poetry.dependencies]
xor-cipher = "^5.0.0"
Alternatively, you can add it directly from the source:
[tool.poetry.dependencies.xor-cipher]
git = "https://github.com/xor-cipher/xor-cipher.git"
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
File details
Details for the file xor_cipher-5.0.0.tar.gz
.
File metadata
- Download URL: xor_cipher-5.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 134aecd1d1d5074a5f4169f4caad402198116340e40c0ddf25026e281c9fa6d6 |
|
MD5 | d22a7a5b977624b305f7882875f00204 |
|
BLAKE2b-256 | bdad58689707dd8e7eb44c1280670fd7923894206f0b6df0672f6163a401a92e |
File details
Details for the file xor_cipher-5.0.0-py3-none-any.whl
.
File metadata
- Download URL: xor_cipher-5.0.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dd140aae00bd564c98542e27ae7c3289e082b87c77a8ec9fb406b4b54a0a060 |
|
MD5 | c49a5b08c0720a0eca5c407f76fc9304 |
|
BLAKE2b-256 | 3346c1f24b9a353389eeb6633b5f9b90e503b33ad00846709922abeb3a911280 |