这里是一个加密的方法,求大神写一个解密方法。
public static string Encode(string pSource, string pKey)
{
bool flag;
string s2;
StringBuilder stringBuilder = new StringBuilder();
pKey = pKey.PadRight(8, '8');
DESCryptoServiceProvider descryptoServiceProvider = new DESCryptoServiceProvider();
try
{
byte[] bArr1 = Encoding.ASCII.GetBytes(pKey);
byte[] bArr2 = Encoding.ASCII.GetBytes(pKey);
byte[] bArr3 = Encoding.UTF8.GetBytes(pSource);
descryptoServiceProvider.Mode = CipherMode.CBC;
descryptoServiceProvider.Key = bArr1;
descryptoServiceProvider.IV = bArr2;
string s1 = "";
MemoryStream memoryStream = new MemoryStream();
try
{
CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Write);
try
{
cryptoStream.Write(bArr3, 0, bArr3.Length);
cryptoStream.FlushFinalBlock();
s1 = Convert.ToBase64String(memoryStream.ToArray());
}
finally
{
flag = cryptoStream == null;
if (!flag)
cryptoStream.Dispose();
}
}
finally
{
flag = memoryStream == null;
if (!flag)
memoryStream.Dispose();
}
s2 = s1;
}
finally
{
flag = descryptoServiceProvider == null;
if (!flag)
descryptoServiceProvider.Dispose();
}
return s2;
}