python - I am getting a 500 server error in Flask when I try to bcrypt or scrypt a password -


i'm new flask , learning way around things making basic application, having trouble password storage. using postgresql , psycopg2 this bcrypt package. works fine if don't try protect password @ or when use sha256, when attempt use bcrypt, 500 server error. here's code:

uname = request.form['uname'] passwd = bcrypt.hashpw(request.form['passwd'], bcrypt.gensalt()) conn = psycopg2.connect("dbname=flask user=postgres host=127.0.0.1 password=mypassword") cur = conn.cursor() cur.execute("insert users (uname, passwd) values (%s, %s)", (uname, passwd)) conn.commit() cur.close() conn.close() 

does know why getting problem? bcrypt taking long? didn't seem take long load before got error back, still it? main goal use bcrypt, swapped out scrypt check , didn't work either.

i know old question, hope people having same problem helped quicker way.

we had problem, debug=true showed wrong. encoding wasn't correct bcrypt. should fix it.

passwd = bcrypt.hashpw(str(request.form['passwd']), bcrypt.gensalt()) 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -