first commit
This commit is contained in:
24
app/utils/EncryptionTool.py
Normal file
24
app/utils/EncryptionTool.py
Normal file
@ -0,0 +1,24 @@
|
||||
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)
|
Reference in New Issue
Block a user