Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2011-07-27 : 11:13:14
|
| Hey so at the moment in my table I have a column calledhash and salthash is my Hashpassword of the user entered string and saltand salt is the single salt valueDuring user login rather than retreive the salt from DB, create the hashpasword in my code and then compare with hash in DB I am told I can do this straight in my stored procedure.This is my stored procedure at the momentALTER PROCEDURE [dbo].[spCheckMemberLogin] ( @username VARCHAR(100) = default, @hash VARCHAR(100) = default ) AS BEGINSET NOCOUNT ON;SELECT 3 as result, * FROM web_user WHERE (statusId = 1) AND (useremail = @username) AND (hash = @hash)ENDInstead of having hash = @hashHow can I have hash = HashBytes('SHA1', salt+user entered password)where salt should be retrieve from table and user entered password is a variable of the stored procedure |
|
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2011-07-27 : 11:44:09
|
| Ah got this workingDoes that look ok ?hash = CONVERT(VARCHAR(100),hashbytes('sha1', @hash + salt),2) |
 |
|
|
|
|
|