-
- string MyDESCrypto(string str, byte[] keys, byte[] ivs)
- {
-
- byte[] strs = Encoding.Unicode.GetBytes(str);
-
-
- DESCryptoServiceProvider desc = new DESCryptoServiceProvider();
- MemoryStream mStream = new MemoryStream();
-
- ICryptoTransform transform = desc.CreateEncryptor(keys, ivs);
- CryptoStream cStream = new CryptoStream(mStream, transform, CryptoStreamMode.Write);
- cStream.Write(strs, 0, strs.Length);
- cStream.FlushFinalBlock();
- return Convert.ToBase64String(mStream.ToArray());
- }
-
-
- string MyDESCryptoDe(string str, byte[] keys, byte[] ivs)
- {
-
- byte[] strs = Convert.FromBase64String(str);
-
- DESCryptoServiceProvider desc = new DESCryptoServiceProvider();
- MemoryStream mStream = new MemoryStream();
-
- ICryptoTransform transform = desc.CreateDecryptor(keys, ivs);
-
- CryptoStream cStream = new CryptoStream(mStream, transform, CryptoStreamMode.Write);
- cStream.Write(strs, 0, strs.Length);
- cStream.FlushFinalBlock();
- return Encoding.Unicode.GetString(mStream.ToArray());
- }
-