aboutsummaryrefslogtreecommitdiff
path: root/api/passwords.py
blob: e2ae552ccdb4fbcd17ab76f71344f0218da7a39c (plain)
1
2
3
4
5
6
7
8
9
10
import bcrypt

def enc(string):
    return string.encode('utf-8')

def check_password(password, password_hash):
    return bcrypt.checkpw(enc(password), password_hash)

def password_hash(password):
    return bcrypt.hashpw(enc(password), bcrypt.gensalt())