Forums

Questions about bcrypt?

Hi, I'm wondering if we need to install this package manually. i'd like to use it in my code but I'm getting a

Traceback (most recent call last): File "/home/mpsippy/password.py", line 4, in <module> hashed = bcrypt.hashpw(password, bcrypt.gensalt()) AttributeError: module 'bcrypt' has no attribute 'hashpw'

error when I try to run my code. If I have to install it how do I do this? If it's not this how do I use this package correctly?

This is my code:

import bcrypt
password = "passwor here"
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
print(hashed)

Make sure that the bcrypt that you've imported is, in fact the bcrypt that you think it is. Make sure it's not some file that you've happened to call bcrypt.