Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text;
- using System.Security.Cryptography;
- namespace CryptoLib
- {
- public static class Encryptor
- {
- public static string MD5Hash(string text)
- {
- MD5 md5 = new MD5CryptoServiceProvider();
- //compute hash from the bytes of text
- md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text));
- //get hash result after compute it
- byte[] result = md5.Hash;
- StringBuilder strBuilder = new StringBuilder();
- for (int i = 0; i < result.Length; i++)
- {
- //change it into 2 hexadecimal digits
- //for each byte
- strBuilder.Append(result[i].ToString("x2"));
- }
- return strBuilder.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement