1
我想散列密碼存儲在我的數據庫中運行到不當行爲,我已經用下面的代碼:
散列密碼字段
ALTER PROCEDURE AddUser
@name NVARCHAR(MAX),
@password NVARCHAR(MAX),
@responseMessage NVARCHAR(MAX) OUTPUT
AS
Begin
SET NOCOUNT ON
INSERT INTO [User] (Username, PasswordHashed)
VALUES (@name, HASHBYTES('SHA2_512', @password));
END
爲了驗證用戶,我用下面的代碼:
SELECT COUNT(*)
FROM [User]
WHERE [User].Username = 'Bamdad' AND [User].PasswordHashed = HASHBYTES('SHA2_512', 'hi');
但結果是0
。爲什麼後面的代碼不工作?