How to get MD5 sum of a string using python?
How to get MD5 sum of a string using python?
You can do the following:
Python 2.x
import hashlib
print hashlib.md5(whatever your string is).hexdigest()
Python 3.x
import hashlib
print(hashlib.md5(whatever your string is.encode(utf-8)).hexdigest())
However in this case youre probably better off using this helpful Python module for interacting with the Flickr API:
… which will deal with the authentication for you.
Official documentation of hashlib
For Python 2.x, use pythons hashlib
import hashlib
m = hashlib.md5()
m.update(000005fab4534d05api_key9a0554259914a86fb9e7eb014e4e5d52permswrite)
print m.hexdigest()
Output: a02506b31c1cd46c2e0b6380fb94eb3d
How to get MD5 sum of a string using python?
You can use b
character in front of a string literal:
import hashlib
print(hashlib.md5(bHello MD5).hexdigest())
print(hashlib.md5(Hello MD5.encode(utf-8)).hexdigest())
Out:
e5dadf6524624f79c3127e247f04b548
e5dadf6524624f79c3127e247f04b548