MD5 checksum returned as a string


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public static string MD5(string password)
  2. {
  3. byte[] textBytes = System.Text.Encoding.Default.GetBytes(password);
  4. try
  5. {
  6. System.Security.Cryptography.MD5CryptoServiceProvider cryptHandler;
  7. cryptHandler = new System.Security.Cryptography.MD5CryptoServiceProvider();
  8. byte[] hash = cryptHandler.ComputeHash(textBytes);
  9. string ret = "";
  10. foreach (byte a in hash)
  11. {
  12. ret += a.ToString("x2");
  13. }
  14. return ret.ToUpper(); ;
  15. }
  16. catch
  17. {
  18. throw;
  19. }
  20. }

URL: http://www.spiration.co.uk/post/1203/MD5%20in%20C%23%20-%20works%20like%20php%20md5%28%29%20example

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.