MD 5暗号化方法32ビット小文字
3525 ワード
///
/// MD5 (32 )
///
///
///
public static string to_MD5(string str)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] fromData = System.Text.Encoding.UTF8.GetBytes(str);
byte[] targetData = md5.ComputeHash(fromData);
string byte2String = null;
for (int i = 0; i < targetData.Length; i++)
{
byte2String = byte2String + targetData[i].ToString("x2");
}
return byte2String;
}
Base 64暗号化方式:
1 ///
2 /// Base64
3 ///
4 ///
5 ///
6 public string EncryptBase64(string source)
7 {
8 byte[] bytes = Encoding.UTF8.GetBytes(source);
9 return Convert.ToBase64String(bytes);
10 }