Spaces:
Runtime error
Runtime error
Download auth.py from VioletWizard/Talk-Trace-AI: direct link, hf CLI and curl.
- Browser
- Download file 441 Bytes
-
https://huggingface.co/spaces/VioletWizard/Talk-Trace-AI/resolve/main/auth.py
- Command line
-
hf download hf://spaces/VioletWizard/Talk-Trace-AI/auth.py
-
curl -L -o auth.py https://huggingface.co/spaces/VioletWizard/Talk-Trace-AI/resolve/main/auth.py
441 Bytes
| import bcrypt | |
| def _hash_password(plain: str) -> str: | |
| return bcrypt.hashpw(plain.encode(), bcrypt.gensalt()).decode() | |
| def _is_hashed(stored: str) -> bool: | |
| return stored.startswith(("$2b$", "$2a$")) | |
| def _verify_password(plain: str, stored: str) -> bool: | |
| if _is_hashed(stored): | |
| try: | |
| return bcrypt.checkpw(plain.encode(), stored.encode()) | |
| except Exception: | |
| return False | |
| return False | |