从数据库检索-Psycopg2/python时,DB中的SHA256 HASH密码添加了额外的后斜线
我目前正在使用一个用户电子邮件地址,并将哈希人与存储在Postgres中的电子邮件地址哈希进行比较。
当我从Python执行查询时,将存储在Postgres中的哈希返回额外的后斜线。
query = "SELECT email_addr_hash FROM TABLE WHERE email_addr_hash_in_db = %s::character varying"
cur.execute(query,(input_addr_hash,))
result = cur.fetchall()
查询不会返回我检索到的db的hash的任何东西:
[('s$O+\\x1d\\xd0\\xac8\\xccU\\xeeW^2|\\\\{\\x0bS.G}h\\xf0S\\x0f\\xbd\\xd4\\xda\\xfc\\x00\\x88',)]
python中的哈希进行比较:
b's$O+\x1d\xd0\xac8\xccU\xeeW^2|\\{\x0bS.G}h\xf0S\x0f\xbd\xd4\xda\xfc\x00\x88'
如果我正确地进行比较以及如何摆脱后斜切,请指导我
I am currently hashing a user email address and comparing the hash with the email address hashes stored in postgres.
The hashes stored in postgres return extra backslashes for the hashed string when I execute query from python.
query = "SELECT email_addr_hash FROM TABLE WHERE email_addr_hash_in_db = %s::character varying"
cur.execute(query,(input_addr_hash,))
result = cur.fetchall()
The query does not return anything cos the hash from db that I retrieve looks like this:
[('s$O+\\x1d\\xd0\\xac8\\xccU\\xeeW^2|\\\\{\\x0bS.G}h\\xf0S\\x0f\\xbd\\xd4\\xda\\xfc\\x00\\x88',)]
The hash in python to compare :
b's$O+\x1d\xd0\xac8\xccU\xeeW^2|\\{\x0bS.G}h\xf0S\x0f\xbd\xd4\xda\xfc\x00\x88'
Please guide me if I am doing the comparison right and how to get rid of off backslashes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论