Onionr/src/onionrcrypto/hashers.py
2019-11-21 02:23:58 -06:00

16 lines
348 B
Python

import hashlib, nacl.hash
def sha3_hash(data):
try:
data = data.encode()
except AttributeError:
pass
hasher = hashlib.sha3_256()
hasher.update(data)
return hasher.hexdigest()
def blake2b_hash(data):
try:
data = data.encode()
except AttributeError:
pass
return nacl.hash.blake2b(data)