XOR Encryption is a little Python library for encrypt and decrypt string with key. This library is for those of you who are learning encryption using the XOR method.
The library uses a simple encryption algorithm that converts plain text and keys to binary form and then XORs them both to generate cipher text. Here's the mathematical notation:
Because performing XOR operations with the same value twice in a row yields the original value, the following is the mathematical notation for decryption:
Note:
- P = Plain text
- K = Key
- C = Cipher text
Example code:
from xorencryption import XOREncryption
plain = "this is your plain text"
key = "boom"
enc = XOREncryption()
enc.set_plaintext(plaintext=plain)
enc.set_key(key=key)
print(enc.encrypt()) # return cipher text
print(enc.decrypt()) # return decrypted text