def hash_with_md5(string): hash = hashlib.md5() string = string.encode('utf-8') hash.update(string) return hash