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