Skip to content

Instantly share code, notes, and snippets.

@songpon
Created November 1, 2017 08:44
Show Gist options
  • Save songpon/5f6896343121dd45a6141d301a6f16d2 to your computer and use it in GitHub Desktop.
Save songpon/5f6896343121dd45a6141d301a6f16d2 to your computer and use it in GitHub Desktop.
import hashlib
def check_sum(data):
# if type dict need to cast to string
if type(data)==type({}):
data = str(data)
# lib require to encode to unicode before hash
hash_object = hashlib.md5(data.encode())
return hash_object.hexdigest()
#test
print(check_sum('{"key":"value"}'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment