MD5 in one line of C# code.
Considering the popularity of using MD5 to hash passwords in a database, I’m litterally baffled as to why Microsoft didn’t include a System.Security.Cryptography.MD5() function. This isn’t quite as nice as that would be, but it gets the job done:
string hash = Convert.ToBase64String(new System.Security.Cryptography.MD5CryptoServiceProvider().
ComputeHash(System.Text.Encoding.Default.GetBytes(SomeString)));
Pretty much every other example I’ve seen are at […]