U +Mb@shdZddlmZddlmZmZmZmZmZm Z m Z eddZ Gddde Z d d d Ze jZe jZdS) a MD4 is specified in RFC1320_ and produces the 128 bit digest of a message. >>> from Crypto.Hash import MD4 >>> >>> h = MD4.new() >>> h.update(b'Hello') >>> print h.hexdigest() MD4 stand for Message Digest version 4, and it was invented by Rivest in 1990. This algorithm is insecure. Do not use it for new designs. .. _RFC1320: http://tools.ietf.org/html/rfc1320 bord)load_pycryptodome_raw_lib VoidPointer SmartPointercreate_string_bufferget_raw_bufferc_size_t c_uint8_ptrzCrypto.Hash._MD4a int md4_init(void **shaState); int md4_destroy(void *shaState); int md4_update(void *hs, const uint8_t *buf, size_t len); int md4_digest(const void *shaState, uint8_t digest[20]); int md4_copy(const void *src, void *dst); c@sPeZdZdZdZdZdZdddZdd Zd d Z d d Z ddZ dddZ dS)MD4Hashz&Class that implements an MD4 hash @z1.2.840.113549.2.4NcCsHt}t|}|r$td|t|tj|_|rD| |dS)N Error %d while instantiating MD4) r _raw_md4_libZmd4_initZ address_of ValueErrorrgetZ md4_destroy_stateupdate)selfdatastateresultr6/tmp/pip-target-t616c12r/lib/python/Crypto/Hash/MD4.py__init__OszMD4Hash.__init__cCs4t|jt|tt|}|r0td|dS)aContinue hashing of a message by consuming the next chunk of data. Repeated calls are equivalent to a single call with the concatenation of all the arguments. In other words: >>> m.update(a); m.update(b) is equivalent to: >>> m.update(a+b) :Parameters: data : byte string/byte array/memoryview The next chunk of the message being hashed. rN)rZ md4_updaterrr r lenr)rrrrrrrZs  zMD4Hash.updatecCs4t|j}t|j|}|r,td|t|S)arReturn the **binary** (non-printable) digest of the message that has been hashed so far. This method does not change the state of the hash object. You can continue updating the object after calling this function. :Return: A byte string of `digest_size` bytes. It may contain non-ASCII characters, including null bytes. r)r digest_sizerZ md4_digestrrrr)rZbfrrrrrdigestrs  zMD4Hash.digestcCsddd|DS)aReturn the **printable** digest of the message that has been hashed so far. This method does not change the state of the hash object. :Return: A string of 2* `digest_size` characters. It contains only hexadecimal ASCII digits. cSsg|]}dt|qS)z%02xr).0xrrr sz%MD4Hash.hexdigest..)joinr)rrrr hexdigests zMD4Hash.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 MD4)r rZmd4_copyrrr)rclonerrrrcopys   z MD4Hash.copycCst|S)N)r )rrrrrnewsz MD4Hash.new)N)N) __name__ __module__ __qualname____doc__r block_sizeoidrrrr#r%r&rrrrr Ds  r NcCs t|S)aReturn a fresh instance of the hash object. :Parameters: data : byte string/byte array/memoryview The very first chunk of the message to hash. It is equivalent to an early call to `MD4Hash.update()`. Optional. :Return: A `MD4Hash` object )r r&)rrrrr&s r&)N)r*ZCrypto.Util.py3compatrZCrypto.Util._raw_apirrrrrr r robjectr r&rr+rrrrs $d