• File: XOR.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/site-packages/Crypto/Cipher/__pycache__/XOR.cpython-37.pyc
  • Date Modified: 01/31/2023 11:01 AM
  • File size: 2.06 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

c
@s<dZdZddlmZGdddZddZdZedd	Zd
S)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@s(eZdZdZddZddZddZdS)		XORCipherzXOR cipher objectcOs,tj|f|||_|jj|_|jj|_dS)zUInitialize a XOR cipher object
        
        See also `new()` at the module level.N)rnew_cipher
block_sizekey_size)selfkeyargskwargsrD/opt/alt/python37/lib64/python3.7/site-packages/Crypto/Cipher/XOR.py__init__(s
zXORCipher.__init__cCs|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).
        )rencrypt)rZ	plaintextrrr
r0s	zXORCipher.encryptcCs|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).
        )rdecrypt)rZ
ciphertextrrr
r;s	zXORCipher.decryptN)__name__
__module____qualname____doc__rrrrrrr
r%srcOst|f||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
rrrr
rFs
r!N)	rZ__revision__Z
Crypto.Cipherrrrrrangerrrrr
<module>s!