我试图通过URL从React Native获取一个密码,然后将其插入MySQL。然后我从数据库中检索它并对照密码进行测试。我已经尝试了各种组合的哈希和密码字符串和编码utf8,但我只得到了错误,请告诉我什么是错的。在
我的get password方法,散列并插入到数据库中@app.route('/signup', methods=['GET'])
def signup():
password = str(request.args.get('password')).encode('utf8')
username = str(request.args.get('username')).encode('utf8')
c.execute("""INSERT INTO profiles
(username, password
)
VALUES
(%s, %s)""", ## gender true==male && false==female
(username, hashed
)
)
con.commit()
在mysql中有一行是这样的(varchar256)
^{pr2}$
我的检索密码方法
^{3}$
每次失败,如果预期为true,则返回false