Dateien
Hetzner-Backup/v2_adminpanel/auth/password.py
2025-06-16 21:14:13 +02:00

11 Zeilen
330 B
Python

import bcrypt
def hash_password(password):
"""Hash a password using bcrypt"""
return bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
def verify_password(password, hashed):
"""Verify a password against its hash"""
return bcrypt.checkpw(password.encode('utf-8'), hashed.encode('utf-8'))