Package Cryptodome :: Package Hash :: Module MD4 :: Class MD4Hash

Class MD4Hash

object --+
         |
        MD4Hash

Class that implements an MD4 hash
Instance Methods
 
__init__(self, data=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
update(self, data)
Continue hashing of a message by consuming the next chunk of data.
 
digest(self)
Return the binary (non-printable) digest of the message that has been hashed so far.
 
hexdigest(self)
Return the printable digest of the message that has been hashed so far.
 
copy(self)
Return a copy ("clone") of the hash object.
 
new(self, data=None)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  digest_size = 16
The size of the resulting hash in bytes.
  block_size = 64
The internal block size of the hash algorithm in bytes.
  oid = '1.2.840.113549.2.4'
ASN.1 Object ID
Properties

Inherited from object: __class__

Method Details

__init__(self, data=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

update(self, 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:

>>> m.update(a); m.update(b)

is equivalent to:

>>> m.update(a+b)
Parameters:
  • data (byte string) - The next chunk of the message being hashed.

digest(self)

 

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.

Returns:
A byte string of digest_size bytes. It may contain non-ASCII characters, including null bytes.

hexdigest(self)

 

Return the printable digest of the message that has been hashed so far.

This method does not change the state of the hash object.

Returns:
A string of 2* digest_size characters. It contains only hexadecimal ASCII digits.

copy(self)

 

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.

Returns:
A hash object of the same type