Working on user module
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
import datetime, pytz, redis
|
||||
from passlib.hash import argon2
|
||||
|
||||
#from datetime import datetime, time, timedelta
|
||||
from fastapi import APIRouter, Depends, Header, HTTPException, status
|
||||
@@ -238,3 +239,16 @@ def lookup_id_random_pop(obj_data:dict):
|
||||
|
||||
return obj_data
|
||||
# ### END ### API Lib General ### lookup_id_random_pop() ###
|
||||
|
||||
|
||||
def secure_hash_string(string:str):
|
||||
string_hash = argon2.using(rounds=14, memory_cost=1536, parallelism=2).hash(string)
|
||||
|
||||
return string_hash
|
||||
|
||||
|
||||
def verify_secure_hash_string(string:str, string_hash:str):
|
||||
if argon2.verify(string, string_hash):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
Reference in New Issue
Block a user