2020-09-10 20:50:41 +00:00
|
|
|
import hashlib
|
|
|
|
|
|
|
|
import nacl.hash
|
|
|
|
|
|
|
|
|
2019-07-19 19:49:56 +00:00
|
|
|
def sha3_hash(data):
|
|
|
|
try:
|
|
|
|
data = data.encode()
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
|
|
|
hasher = hashlib.sha3_256()
|
|
|
|
hasher.update(data)
|
|
|
|
return hasher.hexdigest()
|
|
|
|
|
2020-09-10 20:50:41 +00:00
|
|
|
|
2019-07-19 19:49:56 +00:00
|
|
|
def blake2b_hash(data):
|
|
|
|
try:
|
|
|
|
data = data.encode()
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
2020-09-10 20:50:41 +00:00
|
|
|
return nacl.hash.blake2b(data)
|