U +Mb#@sfddlmZddlmZmZmZmZmZmZm Z m Z ddl m Z Gddde ZddZejZdZd S) bord)load_pycryptodome_raw_lib VoidPointer SmartPointercreate_string_bufferget_raw_bufferc_size_t c_uint8_ptrc_ubyte)_raw_keccak_libc@sNeZdZdZdZdZdZddZddZd d Z d d Z d dZ dddZ dS) SHA3_224_HashzA SHA3-224 hash object. Do not instantiate directly. Use the :func:`new` function. :ivar oid: ASN.1 Object ID :vartype oid: string :ivar digest_size: the size in bytes of the resulting hash :vartype digest_size: integer z2.16.840.1.101.3.4.2.7cCsl||_d|_d|_t}t|t|jdt d}|rHt d|t | tj |_|rh||dS)NF&Error %d while instantiating SHA-3/224)_update_after_digest _digest_done_paddingrr Z keccak_initZ address_ofr digest_sizer ValueErrorrgetZkeccak_destroy_stateupdate)selfdataupdate_after_digeststateresultr!;/tmp/pip-target-t616c12r/lib/python/Crypto/Hash/SHA3_224.py__init__4s"  zSHA3_224_Hash.__init__cCsH|jr|jstdt|jt|tt |}|rDt d||S)zContinue 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. z8You can only call 'digest' or 'hexdigest' on this objectz!Error %d while updating SHA-3/224) rr TypeErrorr Z keccak_absorbrrr r lenr)rrr r!r!r"rEs   zSHA3_224_Hash.updatecCsRd|_t|j}t|j|t|jt|j }|rBt d|t ||_ |j S)zReturn 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 Tr) rrrr Z keccak_digestrrr r rrrZ _digest_value)rZbfrr r!r!r"digestXs   zSHA3_224_Hash.digestcCsddd|DS)zReturn 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).0xr!r!r" vsz+SHA3_224_Hash.hexdigest..)joinr&)rr!r!r" hexdigestnszSHA3_224_Hash.hexdigestcCs4|}t|j|j}|r0td||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 SHA3-224)newr Z keccak_copyrrr)rcloner r!r!r"copyxs   zSHA3_224_Hash.copyNcCst|||jS)z$Create a fresh SHA3-224 hash object.)typer)rrr!r!r"r-szSHA3_224_Hash.new)N) __name__ __module__ __qualname____doc__roid block_sizer#rr&r,r/r-r!r!r!r"r s  r cOsV|dd}|dd}t|dkr8|r0td|d}|rLtdt|t||S) aCreate a new hash object. Args: data (byte string/byte array/memoryview): The very first chunk of the message to hash. It is equivalent to an early call to :meth:`update`. update_after_digest (boolean): Whether :meth:`digest` can be followed by another :meth:`update` (default: ``False``). :Return: A :class:`SHA3_224_Hash` hash object rNrFz%Initial data for hash specified twicerzUnknown parameters: )popr%rr$strr )argskwargsrrr!r!r"r-s   r-rN)ZCrypto.Util.py3compatrZCrypto.Util._raw_apirrrrrr r r ZCrypto.Hash.keccakr objectr r-rr6r!r!r!r"s ( q