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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 One Way Hash C#.Net with SQL Server

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2014-02-24 : 05:10:35
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)

17689 Posts

Posted - 2014-02-24 : 06:44:37
unicode string
SELECT HASHBYTES('SHA1', N'test');



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -