Open fjtello opened 7 years ago
DECLARE @password NVARCHAR(MAX); SET @password = 'APassword'; DECLARE @salt VARBINARY(4); SET @salt = CAST(NEWID() AS VARBINARY(4)); DECLARE @hash VARBINARY(MAX);
SET @hash = 0x0100 + @salt + HASHBYTES('SHA1', CAST(@password AS VARBINARY(MAX)) + @salt);
SELECT @salt password, @hash AS HashValue, PWDCOMPARE(@password,@hash) AS IsPasswordHash;
http://sqlity.net/en/2460/sql-password-hash/
DECLARE @password NVARCHAR(MAX); SET @password = 'APassword'; DECLARE @salt VARBINARY(4); SET @salt = CAST(NEWID() AS VARBINARY(4)); DECLARE @hash VARBINARY(MAX);
SET @hash = 0x0100 + @salt + HASHBYTES('SHA1', CAST(@password AS VARBINARY(MAX)) + @salt);
SELECT @salt password, @hash AS HashValue, PWDCOMPARE(@password,@hash) AS IsPasswordHash;
http://sqlity.net/en/2460/sql-password-hash/