Goal:
Currently learning how to encrypt passwords using Python.
Current code:
import bcrypt
passwd = b'False'
salt = bcrypt.gensalt()
hashed = bcrypt.hashpw(passwd, salt)
x = input()
print(hashed == bcrypt.hashpw(x, hashed))
Problem:
I might be doing this wrong, need a bit of guidance how to achieve this correctly.
How can I insert a input value between the apostrophes forb''
? That's where the password will be and compared to the Hashed one.
This is what I have tried (Also, Im I on the right lines?):
x = b'%s' % (input())
Output on CMD
x = b'%s' % (input())
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
Goal
I am trying to compare input to the hashed password.