Skip to main content

XOR Encryption

Total alerts Language grade: Python

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.

How it Works

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:

XOR encryption 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:

XOR decryption notation

Note:

  • P = Plain text
  • K = Key
  • C = Cipher text

How to Use

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

Metadata

Release files for xorencryption 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xorencryption 0.1.6
File Size Uploaded Provenance Actions
xorencryption-0.1.6.tar.gz 3.6 kB Without provenance Details for xorencryption-0.1.6.tar.gz

Release files / xorencryption-0.1.6.tar.gz

Download URL xorencryption-0.1.6.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b53b21b83810ef8da8836f21f76d8231f03cf39b99c8337294c7887f15daaaaf
BLAKE2b-256 checksum
How to use checksums
18d5b777595cc028c5c1d0abb40b521f4c62ebb2004ae8004a0e89a8968e71e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Security for xorencryption 0.1.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page