U +¥MbUã@sdddlZddlmZddlmZmZmZmZmZm Z eddƒZ dd„Z dd „Z d Z d Zedd ƒZdS) éN)Ú_create_cipher)Úload_pycryptodome_raw_libÚ VoidPointerÚ SmartPointerÚc_size_tÚ c_uint8_ptrÚc_uintzCrypto.Cipher._raw_eksblowfishaa int EKSBlowfish_start_operation(const uint8_t key[], size_t key_len, const uint8_t salt[16], size_t salt_len, unsigned cost, unsigned invert, void **pResult); int EKSBlowfish_encrypt(const void *state, const uint8_t *in, uint8_t *out, size_t data_len); int EKSBlowfish_decrypt(const void *state, const uint8_t *in, uint8_t *out, size_t data_len); int EKSBlowfish_stop_operation(void *state); c Csêz"| d¡}| d¡}| d¡}Wn2tk rT}ztdt|ƒƒ‚W5d}~XYnX| dd¡}t|ƒtkr~tdt|ƒƒ‚tj}tj }t ƒ}|t |ƒt t|ƒƒt |ƒt t|ƒƒt |ƒt t|ƒƒ| ¡ƒ} | rÜtd | ƒ‚t| ¡|ƒS) zˆThis method instantiates and returns a smart pointer to a low-level base cipher. It will absorb named parameters in the process.ÚkeyÚsaltÚcostzMissing EKSBlowfish parameter: NÚinvertTz+Incorrect EKSBlowfish key length (%d bytes)z3Error %X while instantiating the EKSBlowfish cipher)ÚpopÚKeyErrorÚ TypeErrorÚstrÚlenÚkey_sizeÚ ValueErrorÚ_raw_blowfish_libZEKSBlowfish_start_operationZEKSBlowfish_stop_operationrrrrÚintZ address_ofrÚget) Zdict_parametersr r r Úer Zstart_operationZstop_operationZvoid_pÚresult©rúA/tmp/pip-target-t616c12r/lib/python/Crypto/Cipher/_EKSBlowfish.pyÚ_create_base_cipher=s2  "     úÿrcCs"|||dœ}ttjt||f|ŽS)a‚Create a new EKSBlowfish cipher Args: key (bytes, bytearray, memoryview): The secret key to use in the symmetric cipher. Its length can vary from 0 to 72 bytes. mode (one of the supported ``MODE_*`` constants): The chaining mode to use for encryption or decryption. salt (bytes, bytearray, memoryview): The salt that bcrypt uses to thwart rainbow table attacks cost (integer): The complexity factor in bcrypt invert (bool): If ``False``, in the inner loop use ``ExpandKey`` first over the salt and then over the key, as defined in the `original bcrypt specification `_. If ``True``, reverse the order, as in the first implementation of `bcrypt` in OpenBSD. :Return: an EKSBlowfish object )r r r )rÚsysÚmodulesÚ__name__)r Úmoder r r ÚkwargsrrrÚnew^s r!éééI)rZ Crypto.CipherrZCrypto.Util._raw_apirrrrrrrrr!ZMODE_ECBÚ block_sizeÚrangerrrrrÚs  þ!