-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error message #7
Comments
Please provide some python example code |
I had the same issue here, at the decrypt step, i've got the error message :
Here is the code as it was used : def generate_password_hash(password: str) -> str:
return scrypt.encrypt(input=os.urandom(8), password=password, maxtime=0.1)
def verify_password(plain_password: str, hashed_password: bytes) -> bool:
try:
scrypt.decrypt(
input=hashed_password,
password=plain_password,
maxtime=0.5,
)
return True
except scrypt.error:
return False The failure happened at the decrypt step, when decoding the output bytes. The thing i've done was to generate random 32chars string via the libs string & random, and use it as passphrase. import string
import random
def generate_password_hash(password: str) -> str:
passphrase = "".join(random.choice(string.ascii_lowercase) for i in range(32))
return scrypt.encrypt(input=passphrase, password=password, maxtime=0.1)
def verify_password(plain_password: str, hashed_password: bytes) -> bool:
try:
scrypt.decrypt(input=hashed_password, password=plain_password, maxtime=0.5)
return True
except scrypt.error:
return False And now, no errors on the decrypt step. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After encrypt() when I want to decrypt I get a data is not a valid scrypt-encryption block
The text was updated successfully, but these errors were encountered: