I am new to bcrypt and Im trying to use a specific field on my database to create a has with bcrypt.
what I did so far
import bcrypt
# example password
password = "password123"
accountName = "james"
# converting password to array of bytes
pw_bytes = password.encode('utf-8')
# generating the salt
salt = (accountName.Upper()).encode()
# Hashing the password
pw_hash = bcrypt.hashpw(pw_bytes, salt)
print(pw_hash)
I get this error message
invalid salt
I also want to add the cost factor of 4 and I am not sure how to. Some help will do some good.