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