I'm struggling with a legacy code base and an MD5 function (shared below) that is returning a value that I cannot recreate in any fashion via SQL Server, despite using HASHBYTES
, Base64 encoding or other strategies.
Our MD5 C# function:
public string Md5(string value)
{
CryptographyManager crypto = EnterpriseLibraryContainer.Current.GetInstance<CryptographyManager>();
//byte[] valueToHash = (new UnicodeEncoding()).GetBytes(value);
string generatedHash = crypto.CreateHash("MD5CryptoServiceProvider", value);
// Clear the byte array memory.
//Array.Clear(valueToHash, 0, valueToHash.Length);
return generatedHash;
}
When I run the word 'test' through the MD5 function in C#, it returns the following:
RTYSPVSIIGNYx5++zd8EfNwYAONmPWZnsKaYiQHBCP8=
This is not standard Base64 encoding, and I cannot figure out a way to recreate it in SQL for an associated project.
Please help me to understand what the MD5 function above is returning.