目前我的数据库存储了密码'作为文本,但这表示它不起作用,如下所示(密码也转换为MD5哈希):
密码'功能':
VAR_NAME
错误讯息:
user_in = input("Please enter a password next to this text: \n")
Password = hashlib.md5()
Password.update(user_in.encode("utf-8"))
我想知道的是如何将哈希存储在SQLITE3中的数据库中
编辑:
sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.
编辑2:
cursor=db.cursor()
sql="insert into Accounts (Username, Password) values(?,?)"
cursor.execute(sql, (Username, Password))
db.commit()
答案 0 :(得分:1)
确保cursor.execute函数的参数实际上是字符串,你将是金色的! :)
cursor.execute(sql, (str(Username), str(Password)))
这是通过在参数传递
期间强制转换来完成的