【发布时间】:2015-01-29 00:53:18
【问题描述】:
我想知道如何让我的小程序运行起来。我所需要的只是当我输入我的密码 Password321! 以与Password 列下的 MS SQL 数据库中的散列密码进行比较时,我尝试使用 PWDCOMPARE('Password321!', Password); 但它没有为我工作。它出现一个错误,提示 将 nvarchar 值 'nEg5JzRQHD8P7VOwwIkeaDx6WEs=' 转换为数据类型 int 时转换失败。
这是我的代码:
select Password from aspnet_Membership where Password=PWDCOMPARE('Password321!', Password);
请帮忙,
谢谢
M
【问题讨论】:
-
只有在知道 password_hash 时才能使用 PWDCOMPARE('Password321!', Password)。因为 PWDCOMPARE 会将您的 text_format 密码与 password_hash 进行比较。即例如'SELECT SL.name,PWDCOMPARE('********',SL.password_hash) password_match FROM sys.sql_logins AS SL WHERE SL.name = 'ALogin';'
标签: java sql-server database encryption hash