U +¥Mbñã@slddlmZddlmZmZmZmZmZmZm Z eddƒZ Gdd„de ƒZ d dd „Z e jZe jZd d „ZdS) é©Úbord)Úload_pycryptodome_raw_libÚ VoidPointerÚ SmartPointerÚcreate_string_bufferÚget_raw_bufferÚc_size_tÚ c_uint8_ptrzCrypto.Hash._SHA256aÌ int SHA256_init(void **shaState); int SHA256_destroy(void *shaState); int SHA256_update(void *hs, const uint8_t *buf, size_t len); int SHA256_digest(const void *shaState, uint8_t *digest, size_t digest_size); int SHA256_copy(const void *src, void *dst); int SHA256_pbkdf2_hmac_assist(const void *inner, const void *outer, const uint8_t *first_digest, uint8_t *final_digest, size_t iterations, size_t digest_size); c@sPeZdZdZdZdZdZddd„Zdd „Zd d „Z d d „Z dd„Z ddd„Z dS)Ú SHA256Hasha–A SHA-256 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 é é@z2.16.840.1.101.3.4.2.1NcCsHtƒ}t | ¡¡}|r$td|ƒ‚t| ¡tjƒ|_|rD|  |¡dS)Nz#Error %d while instantiating SHA256) rÚ_raw_sha256_libZ SHA256_initZ address_ofÚ ValueErrorrÚgetZSHA256_destroyÚ_stateÚupdate)ÚselfÚdataÚstateÚresult©rú9/tmp/pip-target-t616c12r/lib/python/Crypto/Hash/SHA256.pyÚ__init__GsÿÿzSHA256Hash.__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. z'Error %d while hashing data with SHA256N)rZ SHA256_updaterrr r Úlenr)rrrrrrrRs  þÿzSHA256Hash.updatecCs<t|jƒ}t |j ¡|t|jƒ¡}|r4td|ƒ‚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 z#Error %d while making SHA256 digest) rÚ digest_sizerZ SHA256_digestrrr rr)rÚbfrrrrrÚdigest`s  þÿzSHA256Hash.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%02xr)Ú.0ÚxrrrÚ zsz(SHA256Hash.hexdigest..)Újoinr)rrrrÚ hexdigestrszSHA256Hash.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 SHA256)r rZ SHA256_copyrrr)rÚclonerrrrÚcopy|s  ÿ zSHA256Hash.copycCst|ƒS)z#Create a fresh SHA-256 hash object.)r )rrrrrÚnewŽszSHA256Hash.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:`SHA256Hash.update`. :type data: byte string/byte array/memoryview :Return: A :class:`SHA256Hash` hash object )r r&)rrrrr&“s r&c Cs\|dks t‚tt|ƒƒ}t |j ¡|j ¡||t|ƒtt|ƒƒ¡}|rTtd|ƒ‚t |ƒS)z/Compute the expensive inner loop in PBKDF-HMAC.rz+Error %d with PBKDF2-HMAC assist for SHA256) ÚAssertionErrorrrrZSHA256_pbkdf2_hmac_assistrrr rr)ÚinnerÚouterZ first_digestÚ iterationsrrrrrÚ_pbkdf2_hmac_assist¨s   ú r1)N)ZCrypto.Util.py3compatrZCrypto.Util._raw_apirrrrrr r rÚobjectr r&rr+r1rrrrÚs $ÿb