U +¥MbÚã@sdddlTddlmZmZmZmZmZmZmZeddƒZ Gdd„de ƒZ ddd „Z d Z d Zd d „ZdS)é)Ú*)Úload_pycryptodome_raw_libÚ VoidPointerÚ SmartPointerÚcreate_string_bufferÚget_raw_bufferÚc_size_tÚ c_uint8_ptrzCrypto.Hash._MD5a  #define MD5_DIGEST_SIZE 16 int MD5_init(void **shaState); int MD5_destroy(void *shaState); int MD5_update(void *hs, const uint8_t *buf, size_t len); int MD5_digest(const void *shaState, uint8_t digest[MD5_DIGEST_SIZE]); int MD5_copy(const void *src, void *dst); int MD5_pbkdf2_hmac_assist(const void *inner, const void *outer, const uint8_t first_digest[MD5_DIGEST_SIZE], uint8_t final_digest[MD5_DIGEST_SIZE], size_t iterations); c@sPeZdZdZdZdZdZddd„Zdd „Zd d „Z d d „Z dd„Z ddd„Z dS)ÚMD5Hasha–A MD5 hash object. Do not instantiate directly. Use the :func:`new` function. :ivar oid: ASN.1 Object ID :vartype oid: string :ivar block_size: the size in bytes of the internal message block, input to the compression function :vartype block_size: integer :ivar digest_size: the size in bytes of the resulting hash :vartype digest_size: integer éé@z1.2.840.113549.2.5NcCsHtƒ}t | ¡¡}|r$td|ƒ‚t| ¡tjƒ|_|rD|  |¡dS)Nú Error %d while instantiating MD5) rÚ _raw_md5_libZMD5_initZ address_ofÚ ValueErrorrÚgetZ MD5_destroyÚ_stateÚupdate)ÚselfÚdataÚstateÚresult©rú6/tmp/pip-target-t616c12r/lib/python/Crypto/Hash/MD5.pyÚ__init__HsÿÿzMD5Hash.__init__cCs4t |j ¡t|ƒtt|ƒƒ¡}|r0td|ƒ‚dS)z¼Continue hashing of a message by consuming the next chunk of data. Args: data (byte string/byte array/memoryview): The next chunk of the message being hashed. r N)rZ MD5_updaterrr rÚlenr)rrrrrrrSs  þÿzMD5Hash.updatecCs4t|jƒ}t |j ¡|¡}|r,td|ƒ‚t|ƒS)zçReturn the **binary** (non-printable) digest of the message that has been hashed so far. :return: The hash digest, computed over the data processed so far. Binary form. :rtype: byte string r )rÚ digest_sizerZ MD5_digestrrrr)rÚbfrrrrrÚdigestas  ÿÿzMD5Hash.digestcCsd dd„| ¡Dƒ¡S)zÝReturn the **printable** digest of the message that has been hashed so far. :return: The hash digest, computed over the data processed so far. Hexadecimal encoded. :rtype: string ÚcSsg|]}dt|ƒ‘qS)z%02x)Zbord)Ú.0ÚxrrrÚ zsz%MD5Hash.hexdigest..)Újoinr)rrrrÚ hexdigestrszMD5Hash.hexdigestcCs2tƒ}t |j ¡|j ¡¡}|r.td|ƒ‚|S)a4Return a copy ("clone") of the hash object. The copy will have the same internal state as the original hash object. This can be used to efficiently compute the digests of strings that share a common initial substring. :return: A hash object of the same type zError %d while copying MD5)r rZMD5_copyrrr)rÚclonerrrrÚcopy|s  ÿ z MD5Hash.copycCst|ƒS)z!Create a fresh SHA-1 hash object.)r )rrrrrÚnewŽsz MD5Hash.new)N)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚ block_sizeÚoidrrrr#r%r&rrrrr 1s  r NcCs tƒ |¡S)aCreate a new hash object. :parameter data: Optional. The very first chunk of the message to hash. It is equivalent to an early call to :meth:`MD5Hash.update`. :type data: byte string/byte array/memoryview :Return: A :class:`MD5Hash` hash object )r r&)rrrrr&”s r&r r cCs^t|ƒtkst‚|dkst‚ttƒ}t |j ¡|j ¡||t|ƒ¡}|rVt d|ƒ‚t |ƒS)z/Compute the expensive inner loop in PBKDF-HMAC.rz'Error %d with PBKDF2-HMAC assis for MD5) rrÚAssertionErrorrrZMD5_pbkdf2_hmac_assistrrrrr)ÚinnerÚouterZ first_digestÚ iterationsrrrrrÚ_pbkdf2_hmac_assist§s û r1)N)ZCrypto.Util.py3compatZCrypto.Util._raw_apirrrrrrr rÚobjectr r&rr+r1rrrrÚs$ÿc