George George

George George

  • NA
  • 778
  • 0

MD5 algorithm issue

Jan 6 2009 5:12 AM

Hello everyone,

I am using the following code to generate result of MD5 to a string, my question is how to convert it to an int? The string is 16 bytes, too big for an int. :-)

My purpose is to get the hash code for an input string, but result in the form of an int.

[Code]
           string a = "Input String";
           
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            System.Text.Encoding enc = System.Text.Encoding.UTF8;
            StringBuilder resultBuffer = new StringBuilder();
            byte[] result = md5.ComputeHash(UTF8Encoding.Default.GetBytes(a));
            for (int i = 0; i < result.Length; i++)
            {
                resultBuffer.Append(result[i].ToString("X"));
            }

            string resultStr = resultBuffer.ToString();
[/Code]

regards,
George


Answers (2)