o
    Y¨Êh°
  ã                   @   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   s2   t j|g|¢R i |¤Ž| _| 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   úC/var/www/html/env/lib/python3.10/site-packages/Crypto/Cipher/XOR.pyÚ__init__(   s   
zXORCipher.__init__c                 C   ó   | 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   Ú	plaintextr   r   r   r   0   ó   	zXORCipher.encryptc                 C   r   )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   Ú
ciphertextr   r   r   r   ;   r   zXORCipher.decryptN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   %   s
    r   c                 O   s   t | g|¢R i |¤Ž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__ÚCrypto.Cipherr   r   r   r   Úranger   r   r   r   r   Ú<module>   s   !