MD5Sum function

  • Thread starter Thread starter Gary Townsend
  • Start date Start date
G

Gary Townsend

Hey all i am looking to see if anyone has created a function or knows how to
create an md5sum that would match the md5sum routines found commonly in C++
and Linux.
 
Gary Townsend said:
Hey all i am looking to see if anyone has created a function or knows how
to
create an md5sum that would match the md5sum routines found commonly in
C++
and Linux.

using System.Text.RegularExpressions;
using System.Security.Cryptography;

// Snip class def

protected string MD5Hex( string key )
{
byte[] keybuf = (new UTF8Encoding()).GetBytes(key);
byte[] digest = (new MD5CryptoServiceProvider()).ComputeHash(keybuf);
return (new Regex("-")).Replace(BitConverter.ToString(digest), "");
}

// End Snip
 
Back
Top