25 lines
535 B
Python
25 lines
535 B
Python
import hashlib
|
|
import uuid
|
|
|
|
|
|
def sha256_encode(contents: str):
|
|
res = hashlib.sha256(b"%b" % contents.encode("utf8")).hexdigest()
|
|
return res
|
|
|
|
|
|
def sha3_256_encode(contents: str):
|
|
res = hashlib.sha3_256(b"%b" % contents.encode("utf8")).hexdigest()
|
|
return res
|
|
|
|
|
|
def generate_uuid():
|
|
return uuid.uuid4()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(hashlib.algorithms_guaranteed)
|
|
print(hashlib.algorithms_available)
|
|
print(sha256("res"))
|
|
print(sha3_256("res" + generate_uuid().hex))
|
|
print(generate_uuid().hex)
|