B
     ë?[°
  ã               @   s<   d Z dZddlmZ G d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 )	Ú	XORCipherzXOR cipher objectc             O   s,   t j|f|ž|Ž| _| 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   ú0lib/python3.7/site-packages/Crypto/Cipher/XOR.pyÚ__init__(   s    
zXORCipher.__init__c             C   s   | 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    	zXORCipher.encryptc             C   s   | 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    	zXORCipher.decryptN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   %   s   r   c             O   s   t | f|ž|Ž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   Z__revision__ZCrypto.Cipherr   r   r   r   Úranger   r   r   r   r   Ú<module>   s   !