Guest User

Untitled

a guest
Apr 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. MD5 md5 = MD5.Create();
  2. byte[] data = md5.ComputeHash(Encoding.Default.GetBytes(inputText));
  3.  
  4. // Create a new Stringbuilder to collect the bytes and create a string:
  5. StringBuilder sBuilder = new StringBuilder();
  6.  
  7. // Loop through each byte of the hashed data and format each one as a hexadecimal string:
  8. for (int i = 0; i < data.Length; i++)
  9. {
  10. sBuilder.Append(data[i].ToString("x2"));
  11. }
  12.  
  13. // Return the hexadecimal string:
  14. return sBuilder.ToString();
Add Comment
Please, Sign In to add comment