import bcrypt
# Добавляем b перед строкой, чтобы получились байты,
# т.к. функции модуля работают с ними, а не со строками.
pw = b"Don't use qwerty as the password"
salt = bcrypt.gensalt(rounds=12)
hashed_password = bcrypt.hashpw(pw, salt)
print(hashed_password)
password_to_check = b"Don't use qwerty as the password"
if bcrypt.checkpw(password_to_check, hashed_password):
print('Верно!')
else:
print('Ошибка!')b'$2b$12$fC1UqC0l/3KTRT1HezJhdOKAErECCpVfC5RRSRo7vvvyYP5oeTSda'
Верно!