Skip to content

Latest commit

 

History

History
88 lines (56 loc) · 2.57 KB

md5.rst

File metadata and controls

88 lines (56 loc) · 2.57 KB

MD5

MD5 is specified in RFC1321 and produces the 128 bit digest of a message. For example:

>>> from Crypto.Hash import MD5: >>> >>> h = MD5.new() >>> h.update(b'Hello') >>> print h.hexdigest()

MD5 stand for Message Digest version 5, and it was invented by Rivest in 1991.

Warning

This algorithm is not considered secure. Do not use it for new designs.

Warning

MD5 is vulnerable to length-extension attacks, which are relevant if you are computing the hash of a secret message.

For instance, let's say you were planning to build a cheap MAC by concatenating a secret key to a public message m (bad idea!):


h = MD5(m||k)

By only knowing the digest h and the length of m and k, the attacker can easily compute a second digest h':


h′ = MD5(m||p||z)

where p is a well-known bit string and the attacker can pick a bit string z at will.