An open API service indexing awesome lists of open source software.

https://github.com/carloocchiena/xor_cipher

Simple function to implement XOR Encryption
https://github.com/carloocchiena/xor_cipher

algorithm encryption xor-cipher

Last synced: 9 months ago
JSON representation

Simple function to implement XOR Encryption

Awesome Lists containing this project

README

          

# xor_cipher

The XOR Encryption algorithm is a very effective yet easy to implement method of symmetric encryption. Due to its effectiveness and simplicity, the XOR Encryption is an extremely common component used in more complex encryption algorithms used nowadays.

It operates according to the principles:

A = A, A A = 0, A B = B A, (A B) C = A (B C), (B A) A = B = B, where
denotes the exclusive disjunction (XOR) operation.
This operation is sometimes called modulus 2 addition (or subtraction, which is
identical).
With this logic, a string of text can be encrypted by
applying the bitwise XOR operator to every character using a given key.
To decrypt the output, merely reapplying the XOR function with the key
will remove the cipher.

Text Credits:

Wikipedia

101 Computing

### Usage:


word = cipher("banana")

print (word)



cipher(word)

'banana'