CleverSwarm API invocation example
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from passlib.context import CryptContext
|
||||
|
||||
CRIPTO = CryptContext(schemes=['bcrypt'], deprecated='auto') # Automatically workaround deprecated APIs
|
||||
|
||||
|
||||
def validate_pass(password: str, hash_pass: str) -> bool:
|
||||
"""
|
||||
Verifies if a given password matches the expected hash.
|
||||
It compares the user provided text password with the stored hash of the expected password, that
|
||||
is currently stored in the system.
|
||||
"""
|
||||
|
||||
return CRIPTO.verify(password, hash_pass)
|
||||
|
||||
|
||||
def create_password_hash(password: str) -> str:
|
||||
"""
|
||||
Return the hash of the password
|
||||
"""
|
||||
return CRIPTO.hash(password)
|
||||
Reference in New Issue
Block a user