使用.net进行Base64数据加密算法(源代码)
/// <summary>
///Base64加密
/// </summary>
/// <returns>返回string</returns>
public string EncodeBase64(string s)
{
string strResult="";
if((s!=null)&&(s!=""))
{
strResult=Convert.ToBase64String(System.Text.ASCIIEncoding.Default.GetBytes(s));
}
return strResult;
}
/// <summary>
///Base64解密
/// </summary>
/// <returns>返回string</returns>
public string DecodeBase64(string s)
{
string strResult="";
if((s!=null)&&(s!=""))
{
strResult=System.Text.ASCIIEncoding.Default.GetString(Convert.FromBase64String(s));
}
return strResult;
}