You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

xorencryption

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xorencryption

little Python library for encrypt and decrypt using XOR operation.

0.1.6
pipPyPI
Maintainers
1

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

Keywords

XOR

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts