????MD5????

/// <summary>
/// MD5????
/// </summary>
/// <param name="content">??????????</param>
/// <returns>?????????????</returns>
public static string EncodeMD5(string content)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.Default.GetBytes(content);//????????????????????
byte[] md5data = md5.ComputeHash(data);//????data???????????
md5.Clear();
string str = "";
for (int i = 0; i < md5data.Length - 1; i++)
{
str += md5data[i].ToString("x").PadLeft(2?? '0');
}
return str;
}

????DES?????????

//?????????? (Key) ?????????? (IV) ???????????????? (DES) ??????????
static byte[] desKey=Encoding.UTF8.GetBytes("12345678")?? iv=Encoding.UTF8.GetBytes("12345678");
/// <summary>
/// ????
/// </summary>
/// <param name="content">??????????</param>
/// <returns>????</returns>
public static string Encode(string content)
{
//??????
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
//???????????????????????
byte[] contentArray = Encoding.UTF8.GetBytes(content);
//??????м???
MemoryStream ms = new MemoryStream();
//??????
CryptoStream cs = new CryptoStream(ms?? des.CreateEncryptor(desKey?? iv)?? CryptoStreamMode.Write);
//????  ??д??????
cs.Write(contentArray?? 0?? contentArray.Length);
//????????
cs.FlushFinalBlock();
//??????
return Convert.ToBase64String(ms.ToArray());
}
/// <summary>
/// ????
/// </summary>
/// <param name="password">????</param>
/// <returns>??????????</returns>
public static string Decode(string password)
{
if (string.IsNullOrEmpty(password))
{
return "";
}
//??????
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
//??????????????????  ?????????????????????base64string       ?????????base64string????????????
byte[] passwordArray = Convert.FromBase64String(password);
//??????н???
MemoryStream ms = new MemoryStream(passwordArray);
//??????
CryptoStream cs = new CryptoStream(ms?? des.CreateDecryptor(desKey?? iv)?? CryptoStreamMode.Read);
//?? ?????????????н????????
StreamReader reader = new StreamReader(cs);
//??????
return reader.ReadToEnd();
}