def hash_bytes(data_bytes, output_len=None, algorithm=hashes.SHA1()):
'''
Extract and return output_len bytes from a hash of data_bytes.
If output_len is None, return the full hash length.
'''
hash_context = hash_create(algorithm=algorithm)
hash_context = hash_update(hash_context, data_bytes)
return hash_extract(hash_context,
output_len=output_len,
make_context_reusable=False)
# Tor-specific hash functions
评论列表
文章目录