I am wanting to use the Bcrypt module. I have this for quick testing purposes, as follows:
import bcrypt
password = b"super secret password"
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
if bcrypt.checkpw(password, hashed):
print("It matches!")
else:
print("Password doesnt match")
When trying to run this, I receive the following error:
Traceback (most recent call last):
File "bcrypt.py", line 1, in <module>
import bcrypt
File "/Users/Kai/playground/bcrypt.py", line 5, in <module>
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
AttributeError: module 'bcrypt' has no attribute 'hashpw'
When trying to run this inside of the Python Interpreter WITHIN the "playground" directory I receive the same error.
But when I go to my home directory ~/
and run the same code through the Python Interpreter it works perfectly fine
I have done both pip3 install bcrypt --upgrade
& pip install bcrypt --upgrade
.
I am wanting to find out what I can do to fix the issue, I have also uninstalled and reinstalled Python3 as well.