SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 One Way Hash C#.Net with SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kalaiselvan
Posting Yak Master

India
110 Posts

Posted - 02/24/2014 :  05:10:35  Show Profile  Reply with Quote
Hi,
We are using One Way Hash SHA1 Crypto service to convert the Password String and further converted to Byte Array and storing it as Hashed Value.
The same am using in SQL Server has SELECT HASHBYTES('SHA1', 'test');
But the Output seems to be different and the Hash code comes from SQL is not valid.


Ex:
Var Password='test'
C#.Net Output HAshed Value= 87F8ED9157125FFC4DA9E06A7B8011AD80A53FE1
SQL:
SELECT HASHBYTES('SHA1', 'test');
RETURNS: 0xA94A8FE5CCB19BA61C4C0873D391E987982FBBD3

Can you please help me to Match this SHA1 Output in SQL Query. I need the Output same as from C#.net.


Regards,
Kalaiselvan R

Regards,
Kalai

khtan
In (Som, Ni, Yak)

Singapore
17681 Posts

Posted - 02/24/2014 :  06:44:37  Show Profile  Reply with Quote
unicode string
SELECT HASHBYTES('SHA1', N'test');



KH
Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000