def secure_hash_s(data, hash_func=sha1):
 digest = hash_func()
 data = to_bytes(data, errors='surrogate_or_strict')
 digest.update(data)
 return digest.hexdigest()

def secure_hash_s ( data , hash_func = sha1 ) : digest = hash_func ( ) data = to_bytes ( data , errors = 'surrogate_or_strict' ) digest . update ( data ) return digest . hexdigest ( )
return a secure hash hex digest of data .