HI All,
I have an issue which is most likely a lack of knowledge on my part,
I have a situation which requires me to compare a hash (MD5) generated in an ASP.Net application against a text value (the pre-hashed value) in SQL 2005.
The hash comes from a cookie and was hashed as MD5 using System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile()
In SQL I am using the function HASHBYTES
Please consider the following query:
SELECT UID
FROM t_Collected_Users
WHERE HashBytes('MD5',Username) = @Username
AND HashBytes('MD5', Password) = @Password
Where the paramaters @Username and @Password are 32 character hashes generated ASP.Net side. The trouble is the sql function HashBytes creates a 16 character hash, so the two never compare.
What can I do to the 32 Character ASP.Net hash to make it a 16 character SQL compatible MD5 hash?
Many Thanks