Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Security.Cryptography;
- public class MD5Helper
- {
- public static string ToMD5(string Key, string Value)
- {
- byte[] bytes = Encoding.Default.GetBytes(Key);
- byte[] buffer = Encoding.Default.GetBytes(Value);
- byte[] buffer2 = new HMACMD5(bytes).ComputeHash(buffer);
- //return Encoding.Default.GetString(buffer2);
- StringBuilder bulider= new StringBuilder(buffer2.Length);
- for (int i = 0; i <= buffer2.Length - 1; i++)
- {
- bulider.Append(buffer2[i].ToString("x"));
- }
- return bulider.ToString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment