
    Eh
                     H    d Z dZddlmZ  G d d      Zd ZdZ edd      Zy	)
zXOR 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                   "    e Zd ZdZd Zd Zd Zy)	XORCipherzXOR cipher objectc                     t        j                  |g|i || _        | j                  j                  | _        | j                  j                  | _        y)zUInitialize a XOR cipher object
        
        See also `new()` at the module level.N)r   new_cipher
block_sizekey_size)selfkeyargskwargss       R/var/www/html/bid_assistant/venv/lib/python3.12/site-packages/Crypto/Cipher/XOR.py__init__zXORCipher.__init__(   s@     xx5d5f5,,11--    c                 8    | j                   j                  |      S )zEncrypt 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   	plaintexts     r   r   zXORCipher.encrypt0   s     ||##I..r   c                 8    | j                   j                  |      S )zDecrypt 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   
ciphertexts     r   r   zXORCipher.decrypt;   s     ||##J//r   N)__name__
__module____qualname____doc__r   r   r    r   r   r   r   %   s    .	/	0r   r   c                      t        | g|i |S )zCreate 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   s      r   r   r   F   s     S*4*6**r      !   N)	r   __revision__Crypto.Cipherr   r   r   r	   xranger
   r   r   r   <module>r#      s6   ,	  0 0B
+ 
!D>r   