MD5: Difference between revisions

Content added Content deleted
Line 1,199: Line 1,199:
Using builtin libraries:
Using builtin libraries:


Python 2.5 and later:
;Python 3.x, 2.5 and later 2.x versions:
<lang python>>>> import hashlib
<lang python>>>> import hashlib
>>> # RFC 1321 test suite:
>>> # RFC 1321 test suite:
Line 1,214: Line 1,214:
>>> </lang>
>>> </lang>


Python 2.5 and later:
;Python 2.5 and later:
<lang python>>>> import hashlib
<lang python>>>> import hashlib
>>> print hashlib.md5("The quick brown fox jumped over the lazy dog's back").hexdigest()
>>> print hashlib.md5("The quick brown fox jumped over the lazy dog's back").hexdigest()
e38ca1d920c4b8b8d3946b2c72f01680</lang>
e38ca1d920c4b8b8d3946b2c72f01680</lang>


Pre-2.5; removed in 3.x:
;Pre-2.5; removed in 3.x:
<lang python>>>> import md5
<lang python>>>> import md5
>>> print md5.md5("The quick brown fox jumped over the lazy dog's back").hexdigest()
>>> print md5.md5("The quick brown fox jumped over the lazy dog's back").hexdigest()