Simple, reusable and optimized XOR ciphers in Python (core).
xor-cipher-core
is the core of xor-cipher
.
Python 3.8 or above is required.
Installing the library with pip
is quite simple:
$ pip install xor-cipher-core
Alternatively, the library can be installed from source:
$ pip install git+https://github.com/xor-cipher/xor-cipher-core.git
Or via cloning the repository:
$ git clone https://github.com/xor-cipher/xor-cipher-core.git
$ cd xor-cipher-core
$ pip install .
You can add xor-cipher-core
as a dependency with the following command:
$ uv add xor-cipher-core
Use the xor
function to perform the simple XOR cipher:
>>> from xor_cipher_core import xor
>>> xor(b"Hello, world!", 0x42)
b"\n'..-nb5-0.&c"
Use the cyclic_xor
function to perform the cyclic XOR variation:
>>> from xor_cipher_core import cyclic_xor
>>> cyclic_xor(b"Hello, world!", b"BLOB")
b"\n)#.-`o5->#&c"
There are functions to perform the XOR cipher in-place, on bytearray
instances:
>>> from xor_cipher_core import xor_in_place
>>> data = bytearray(b"Hello, world!")
>>> xor_in_place(data, 0x42)
>>> data
bytearray(b"\n'..-nb5-0.&c")
You can find the documentation here.
If you need support with the library, you can send an email.
You can find the changelog here.
You can find the Security Policy of xor-cipher-core
here.
If you are interested in contributing to xor-cipher-core
, make sure to take a look at the
Contributing Guide, as well as the Code of Conduct.
xor-cipher-core
is licensed under the MIT License terms. See License for details.