U +¥Mbþã@sJddlmZmZmZmZmZmZeddƒZd dd„Zd dd„Z d d „Z dS) é)Úload_pycryptodome_raw_libÚc_size_tÚcreate_string_bufferÚget_raw_bufferÚ c_uint8_ptrÚis_writeable_bufferzCrypto.Util._strxoray void strxor(const uint8_t *in1, const uint8_t *in2, uint8_t *out, size_t len); void strxor_c(const uint8_t *in, uint8_t c, uint8_t *out, size_t len); NcCsžt|ƒt|ƒkrtdƒ‚|dkr.tt|ƒƒ}n4|}t|ƒsBtdƒ‚t|ƒt|ƒkrbtdt|ƒƒ‚t t|ƒt|ƒt|ƒtt|ƒƒ¡|dkr–t |ƒSdSdS)aØXOR two byte strings. Args: term1 (bytes/bytearray/memoryview): The first term of the XOR operation. term2 (bytes/bytearray/memoryview): The second term of the XOR operation. output (bytearray/memoryview): The location where the result must be written to. If ``None``, the result is returned. :Return: If ``output`` is ``None``, a new ``bytes`` string with the result. Otherwise ``None``. z.Only byte strings of equal length can be xoredNú4output must be a bytearray or a writeable memoryviewú9output must have the same length as the input (%d bytes)) ÚlenÚ ValueErrorrrÚ TypeErrorÚ _raw_strxorÚstrxorrrr)Úterm1Úterm2ÚoutputÚresult©rú9/tmp/pip-target-t616c12r/lib/python/Crypto/Util/strxor.pyr/s&ÿ  ýrcCs d|krdksntdƒ‚|dkr4tt|ƒƒ}n4|}t|ƒsHtdƒ‚t|ƒt|ƒkrhtdt|ƒƒ‚t t|ƒ|t|ƒtt|ƒƒ¡|dkr˜t |ƒSdSdS)aîXOR a byte string with a repeated sequence of characters. Args: term(bytes/bytearray/memoryview): The first term of the XOR operation. c (bytes): The byte that makes up the second term of the XOR operation. output (None or bytearray/memoryview): If not ``None``, the location where the result is stored into. Return: If ``output`` is ``None``, a new ``bytes`` string with the result. Otherwise ``None``. rézc must be in range(256)Nrr ) r rr rr r Ústrxor_crrr)ÚtermÚcrrrrrrZs&ÿ  ýrcCst |||tt|ƒƒ¡dS)z!Very fast XOR - check conditions!N)r rrr )rrrrrrÚ_strxor_direct†sr)N)N) ZCrypto.Util._raw_apirrrrrrr rrrrrrrÚs ÿ + ,