I have a method used to generate a hash:
public static string GetMD5Hash(string input)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}
I then save that hash in a varchar(255) column. Knowing what the original input string was, would it be possible to to arrive at the same hash value stored in the varchar(255) column, using sql (2005)??
I have tried like crazy using different data types, conversions and the hashbytes() function, but have not been able to get close.
Example of my failed attempt :(
select convert(varchar, hashbytes('MD5', convert(varbinary(200), '<censored>',0)))