【发布时间】:2017-06-03 17:10:05
【问题描述】:
目前我的数据库将“密码”存储为文本,但这表示它不起作用,如下所示(密码也转换为 MD5 哈希):
密码“功能”:
user_in = input("Please enter a password next to this text: \n")
Password = hashlib.md5()
Password.update(user_in.encode("utf-8"))
错误信息:
sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.
我想知道的是如何在 SQLITE3 的数据库中存储哈希
编辑:
cursor=db.cursor()
sql="insert into Accounts (Username, Password) values(?,?)"
cursor.execute(sql, (Username, Password))
db.commit()
编辑 2:
user_in = input("Please enter a password next to this text: \n")
Password = hashlib.md5()
Password.update(user_in.encode("utf-8"))
Password.hexdigest()
【问题讨论】:
-
您是在运行python函数时遇到错误,还是在实际提交到SQLServer时遇到错误?
-
@Polymer 你好。输入用户名和密码后出现错误,所以当它被提交到 SQL 服务器时
-
你能添加你用来提交到服务器的代码吗?同样在您的服务器上,您的密码设置为哪种类型?
-
@Polymer 设置为文本。我将添加上面的代码。
-
您是否使用 password.hexdigest() 作为 Password 变量?