public static string Encrypt(string Text, string sKey)
{
DESCryptoServiceProvider dESCryptoServiceProvider = new DESCryptoServiceProvider();
byte[] bytes = Encoding.Default.GetBytes(Text);
dESCryptoServiceProvider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
dESCryptoServiceProvider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
MemoryStream expr_5B = new MemoryStream();
CryptoStream expr_68 = new CryptoStream(expr_5B, dESCryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Write);
expr_68.Write(bytes, 0, bytes.Length);
expr_68.FlushFinalBlock();
StringBuilder stringBuilder = new StringBuilder();
byte[] array = expr_5B.ToArray();
for (int i = 0; i < array.Length; iPP)
{
byte b = array[i];
stringBuilder.AppendFormat("{0:X2}", b);
}
return stringBuilder.ToString();
}
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)