Skip to content

XOR Encryption is a little Python library for encrypt and decrypt string with key.

License

Notifications You must be signed in to change notification settings

AlvifSandana/xorencryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XOR Encryption

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

About

XOR Encryption is a little Python library for encrypt and decrypt string with key.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages