赞
踩
public static string Base64Decode(string str)
{
byte[] bytes = Convert.FromBase64String(str);
bytes = Convert.FromBase64String(Encoding.Default.GetString(bytes));
return Encoding.Default.GetString(bytes);
}
public static string Base64Encode(string str)
{
string go = Convert.ToBase64String(Encoding.Default.GetBytes(str));
return Convert.ToBase64String(Encoding.Default.GetBytes(go));
}
public string Md5Sum(string value)
{
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(value);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
————————————————
版权声明:本文为CSDN博主「旺叫兽」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_22780533/article/details/51801181
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。