AKA SULVERUS : , #072, . 072-034-3 [ .] , . Triple DES TripleDES Crypto Service Provider - . , System.Security.Cryptography TripleDES . public bool Encrypt() public bool Decrypt() . , , . : , , (, , ). : TripleDES public class TripleDES { public static bool Encrypt(string OpenText, string SafeKey, string EncrText) { try { DESCryptoServiceProvider TDes = new DESCryptoServiceProvider(); // // TDes.Key = ASCIIEncoding.ASCII.GetBytes(SafeKey); TDes.GenerateIV(); // ICryptoTransform encryption = TDes.CreateEncryptor(); // FileStream Fin = new FileStream(OpenText, FileMode.Open, FileAccess.Read); // FileStream Fout = new FileStream(EncrText, FileMode.Create, FileAccess.Write); CryptoStream crypt = new CryptoStream(Fout, encryption, CryptoStreamMode.Write); byte[] outtext = new byte[Fin.Length - 1]; Fin.Read(outtext, 0, outtext.Length); crypt.Write(outtext, 0, outtext.Length); // crypt.Close(); // Fin.Close(); Fout.Close(); Console.WriteLine("Done"); return true; } // } public static bool Decrypt(string SafeText, string SafeKey, string OpenText) { try { TripleDESCryptoServiceProvider TDesDec = new TripleDESCryptoServiceProvider(); // TDesDec.Key = ASCIIEncoding.ASCII.GetBytes(SafeKey); TDesDec.GenerateIV(); // FileStream SText = new FileStream(SafeText, FileMode.Open, FileAccess.Read); ICryptoTransform decrypt = TDesDec.CreateDecryptor(); CryptoStream DecryptionStream = new CryptoStream(SText, decrypt, CryptoStreamMode.Read); // StreamWriter OpenT = new StreamWriter(OpenText); OpenT.Write(new StreamReader(DecryptionStream).ReadToEnd()); // OpenT.Flush(); // OpenT.Close(); Console.WriteLine("Done"); return true; } // } } TripleDES.Encrypt() TripleDES, , ICryptoTransform , , . . , . , - , . ( Xakep - Super Hypper Rulez!) : dc` rӐqi UdW:`- ͆. , - , . . |