Package Crypto :: Package Hash :: Module MD5 :: Class MD5Hash
[frames] | no frames]

Class MD5Hash

hashalgo.HashAlgo --+
                    |
                   MD5Hash

Class that implements an MD5 hash
Instance Methods
 
__init__(self, data=None)
Initialize the hash object.
 
new(self, data=None)
Return a fresh instance of the hash object.
    Inherited from hashalgo.HashAlgo
 
copy(self)
Return a copy ("clone") of the hash object.
 
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.
 
update(self, data)
Continue hashing of a message by consuming the next chunk of data.
Class Variables
  oid = '\x06\x08*\x86H\x86\xf7\r\x02\x05'
ASN.1 Object identifier (OID):
  digest_size = 16
The size of the resulting hash in bytes.
Method Details

__init__(self, data=None)
(Constructor)

 
Initialize the hash object.
Parameters:
  • hashFactory - An object that will generate the actual hash implementation. hashFactory must have a new() method, or must be directly callable.
  • data - The very first chunk of the message to hash. It is equivalent to an early call to update().
Overrides: hashalgo.HashAlgo.__init__
(inherited documentation)

new(self, data=None)

 

Return a fresh instance of the hash object.

Unlike the copy method, the internal state of the object is empty.

Parameters:
  • data - The next chunk of the message being hashed.
Returns:
A hash object of the same type
Overrides: hashalgo.HashAlgo.new
(inherited documentation)

Class Variable Details

oid

ASN.1 Object identifier (OID):

id-md5      OBJECT IDENTIFIER ::= {
    iso(1) member-body(2) us(840) rsadsi(113549)
     digestAlgorithm(2) 5
}

This value uniquely identifies the MD5 algorithm.

Value:
'\x06\x08*\x86H\x86\xf7\r\x02\x05'