B õØc° ã@s<dZdZddlmZGdd„dƒZdd„ZdZedd ƒZd 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(eZdZdZdd„Zdd„Zdd„ZdS) Ú XORCipherzXOR cipher objectcOs,tj|f|ž|Ž|_|jj|_|jj|_dS)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/python37/lib64/python3.7/site-packages/Crypto/Cipher/XOR.pyÚ__init__(s zXORCipher.__init__cCs |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)rZ plaintextr r r r0s zXORCipher.encryptcCs |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)rZ ciphertextr r r r;s zXORCipher.decryptN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr r r r r%s rcOst|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 rFs réé!N) rZ __revision__Z Crypto.CipherrrrrÚrangerr r r r Ús  !