Package Crypto :: Package Hash :: Module MD2 :: Class MD2
[frames] | no frames]

Class MD2

object --+
         |
        Crypto.Hash.MD2.MD2

Class that implements a MD2 hash.
Instance Methods
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
copy()
Return a copy ("clone") of the hash object.
 
digest()
Return the binary (non-printable) digest of the message that has been hashed so far.
 
hexdigest()
Return the printable digest of the message that has been hashed so far.
 
new(data=None)
Return a fresh instance of the hash object.
 
update(data)
Continue hashing of a message by consuming the next chunk of data.

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

Properties

Inherited from object: __class__

Method Details

__getattribute__(...)

 
x.__getattribute__('name') <==> x.name
Overrides: object.__getattribute__

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.

Returns:
A hash object of the same 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.

characters, including null bytes.

Returns:
A byte string of digest_size bytes. It may contain non-ASCII

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.

hexadecimal ASCII digits.

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

new(data=None)

 
Return a fresh instance of the hash object.
Parameters:
  • data (byte string) - The very first chunk of the message to hash. It is equivalent to an early call to MD2.update(). Optional.
Returns:
A MD2 object

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:

>>> 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.