|
1public class CryptUtil 2 { 3 public static string DecryptString(string input) 4 { 5 if (input.Equals(string.Empty)) 6 { 7 return input; 8 } 9 10 byte[] byKey = {0x63, 0x68, 0x65, 0x6E, 0x79, 0x75, 0x61, 0x6E}; 11 byte[] IV = {0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10}; 12 byte[] inputByteArray = new Byte[input.Length]; 13 DESCryptoServiceProvider des = new DESCryptoServiceProvider(); 14 inputByteArray = Convert.FromBase64String(input); 15 MemoryStream ms = new MemoryStream(); 16 CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write); 17 cs.Write(inputByteArray, 0, inputByteArray.Length); 18 cs.FlushFinalBlock(); 19 Encoding encoding = new UTF8Encoding(); 20 return encoding.GetString(ms.ToArray());
上一篇:Photoshop快速打造皱纸画面效果
下一篇:白领亚健康9个饮食调理贴士
|