Package Crypto :: Package Cipher :: Module XOR
[frames] | no frames]

Module XOR

XOR toy cipher

XOR is one the simplest stream ciphers. Encryption and decryption are performed by XOR-ing data with a keystream made by contatenating the key.

Do not use it for real applications!

Classes
  XORCipher
XOR cipher object
Functions
 
new(key, *args, **kwargs)
Create a new XOR cipher
Variables
  block_size = 1
Size of a data block (in bytes)
  key_size = xrange(1, 33)
Size of a key (in bytes)
Function Details

new(key, *args, **kwargs)

 
Create a new XOR cipher
Parameters:
  • key (byte string) - The secret key to use in the symmetric cipher. Its length may vary from 1 to 32 bytes.
Returns:
an XORCipher object