Your IP : 216.73.216.213
���^�
� @ sT d Z d Z d d l m Z Gd d � d � Z d d � Z d Z e d d � Z d
S)z�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!
:undocumented: __revision__, __package__
z$Id$� )�_XORc @ s: e Z d Z d Z d d � Z d d � Z d d � Z d S) � XORCipherzXOR cipher objectc O s: t j | | | � | _ | j j | _ | j j | _ d S)zUInitialize a XOR cipher object
See also `new()` at the module level.N)r �new�_cipher�
block_size�key_size)�self�key�args�kwargs� r �D/opt/alt/python35/lib64/python3.5/site-packages/Crypto/Cipher/XOR.py�__init__( s zXORCipher.__init__c C s | j j | � S)z�Encrypt a piece of data.
:Parameters:
plaintext : byte string
The piece of data to encrypt. It can be of any size.
:Return: the encrypted data (byte string, as long as the
plaintext).
)r �encrypt)r Z plaintextr r r
r 0 s zXORCipher.encryptc C s | j j | � S)z�Decrypt a piece of data.
:Parameters:
ciphertext : byte string
The piece of data to decrypt. It can be of any size.
:Return: the decrypted data (byte string, as long as the
ciphertext).
)r �decrypt)r Z
ciphertextr r r
r ; s zXORCipher.decryptN)�__name__�
__module__�__qualname__�__doc__r r r r r r r
r % s r c O s t | | | � S)z�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.
:Return: an `XORCipher` object
)r )r r
r r r r
r F s
r � � N�! ) r �__revision__Z
Crypto.Cipherr r r r �ranger r r r r
�<module> s !