MD4¶
MD4 is specified in RFC1320 and it produces the 128 bit digest of a message. For example:
>>> 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.
Warning
This algorithm is not considered secure. Do not use it for new designs.
- class Crypto.Hash.MD4.MD4Hash(data=None)¶
Class that implements an MD4 hash
- copy()¶
Return 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
- Return type:
- digest()¶
Return 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.
- Return type:
- hexdigest()¶
Return 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.
- Return type:
- update(data)¶
Continue 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: :rtype:
None>>> m.update(a); m.update(b)
is equivalent to:
>>> m.update(a+b)
- Parameters:
- databyte string/byte array/memoryview
The next chunk of the message being hashed.