0
Code:
import bcrypt
hashed = bcrypt.hashpw('teste',bcrypt.gensalt())
error:
Typeerror: Unicode-Objects must be encoded before hashing
Running the program shows this error, how can I fix?
0
Code:
import bcrypt
hashed = bcrypt.hashpw('teste',bcrypt.gensalt())
error:
Typeerror: Unicode-Objects must be encoded before hashing
Running the program shows this error, how can I fix?
1
The parameter must be of the type bytes
, you can call it two ways, giving a cast to bytes
hashed = bcrypt.hashpw(b'teste',bcrypt.gensalt())
or using an encoding:
hashed = bcrypt.hashpw('teste'.encode("utf-8"),bcrypt.gensalt())
Browser other questions tagged python python-3.x bcrypt
You are not signed in. Login or sign up in order to post.