Code:
import bcrypt
hashed = bcrypt.hashpw('teste',bcrypt.gensalt())
error:
TypeError: Unicode-objects must be encoded before hashing
When running the program, you have this error, how can I solve it?
Code:
import bcrypt
hashed = bcrypt.hashpw('teste',bcrypt.gensalt())
error:
TypeError: Unicode-objects must be encoded before hashing
When running the program, you have this error, how can I solve it?
The parameter must be of type bytes
, you can call it in two ways, casting bytes
hashed = bcrypt.hashpw(b'teste',bcrypt.gensalt())
or by using an encoding:
hashed = bcrypt.hashpw('teste'.encode("utf-8"),bcrypt.gensalt())