mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-05 04:46:07 +01:00
13 lines
410 B
Python
13 lines
410 B
Python
import uuid
|
|
import hashlib
|
|
|
|
|
|
def hash_password(password):
|
|
# uuid is used to generate a random number
|
|
salt = uuid.uuid4().hex
|
|
return hashlib.sha256(salt.encode() + password.encode()).hexdigest() + ':' + salt
|
|
|
|
|
|
def check_password(hashed_password, user_password):
|
|
password, salt = hashed_password.split(':')
|
|
return password == hashlib.sha256(salt.encode() + user_password.encode()).hexdigest() |