Working on user module

This commit is contained in:
Scott Idem
2021-03-18 22:34:35 +00:00
parent dc68970809
commit 7682c7d080
8 changed files with 378 additions and 4 deletions

View File

@@ -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