-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathpython_MD5.py
More file actions
30 lines (22 loc) · 856 Bytes
/
python_MD5.py
File metadata and controls
30 lines (22 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from . import pymd5
__all__ = ['new','digest_size']
def new(data=None):
"""Create a new pure python MD5 hash object
data = initial input (raw string) to the hashing object
if present, the method call update(arg) is made
EXAMPLE: (http://www.rfc-editor.org/rfc/rfc1321.txt)
=========
>>> from CryptoPlus.Hash import MD5
>>> message = b"abc"
>>> hasher = MD5.new()
>>> hasher.update(message)
>>> hasher.hexdigest()
'900150983cd24fb0d6963f7d28e17f72'
>>> message = b"message digest"
>>> hasher = MD5.new()
>>> hasher.update(message)
>>> hasher.hexdigest()
'f96b697d7cb7938d525a2f31aaf161d0'
"""
return pymd5.new(data)
digest_size = pymd5.digest_size