moje zdrojovy kody.... pokud chces unitu z pascalu tak napis
Kód:
public static void EncryptData(String inName, String outName, byte[] rijnKey, byte[] rijnIV)
		{    
			//Create the file streams to handle the input and output files.
			FileStream fin = new FileStream(inName, FileMode.Open, FileAccess.Read);
			FileStream fout = new FileStream(outName, FileMode.OpenOrCreate, FileAccess.Write);
			fout.SetLength(0);
       
			//Create variables to help with read and write.
			byte[] bin = new byte[100]; //This is intermediate storage for the encryption.
			long rdlen = 0;              //This is the total number of bytes written.
			long totlen = fin.Length;    //This is the total length of the input file.
			int len;                     //This is the number of bytes to be written at a time.
 
			//SymmetricAlgorithm tdes = SymmetricAlgorithm.Create("TDES"); //Creates the default implementation, which is RijndaelManaged.         
			
			TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
						
			tdes.Mode = System.Security.Cryptography.CipherMode.ECB;
			tdes.Padding = System.Security.Cryptography.PaddingMode.Zeros; 
			
			CryptoStream encStream = new CryptoStream(fout, tdes.CreateEncryptor(rijnKey, rijnIV), CryptoStreamMode.Write);
                
			Console.WriteLine("Encrypting...");
 
			//Read from the input file, then encrypt and write to the output file.
			while&#40;rdlen < totlen&#41;
			&#123;
				len = fin.Read&#40;bin, 0, 100&#41;;
				encStream.Write&#40;bin, 0, len&#41;;
				rdlen = rdlen + len;
				Console.WriteLine&#40;"&#123;0&#125; bytes processed", rdlen&#41;;
			&#125;
 
			encStream.Close&#40;&#41;;  
			fout.Close&#40;&#41;;
			fin.Close&#40;&#41;;                
		&#125;

		public static void DescryptData&#40;String inName, String outName, byte&#91;&#93; rijnKey, byte&#91;&#93; rijnIV&#41;
		&#123;    
			//Create the file streams to handle the input and output files.
			FileStream fin = new FileStream&#40;inName, FileMode.Open, FileAccess.Read&#41;;
			FileStream fout = new FileStream&#40;outName, FileMode.OpenOrCreate, FileAccess.Write&#41;;
			fout.SetLength&#40;0&#41;;
       
			//Create variables to help with read and write.
			byte&#91;&#93; bin = new byte&#91;100&#93;; //This is intermediate storage for the encryption.
			long rdlen = 0;              //This is the total number of bytes written.
			long totlen = fin.Length;    //This is the total length of the input file.
			int len;                     //This is the number of bytes to be written at a time.
 
			//SymmetricAlgorithm tdes = SymmetricAlgorithm.Create&#40;&#41;; //Creates the default implementation, which is RijndaelManaged.         
			System.Security.Cryptography.TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider&#40;&#41;;
			tdes.Mode = System.Security.Cryptography.CipherMode.ECB;
			tdes.Padding = System.Security.Cryptography.PaddingMode.Zeros; 
			
			CryptoStream encStream = new CryptoStream&#40;fout, tdes.CreateDecryptor&#40;rijnKey, rijnIV&#41;, CryptoStreamMode.Write&#41;;
                
			Console.WriteLine&#40;"Descrypting..."&#41;;
 
			//Read from the input file, then encrypt and write to the output file.
			while&#40;rdlen < totlen&#41;
			&#123;
				len = fin.Read&#40;bin, 0, 100&#41;;
				encStream.Write&#40;bin, 0, len&#41;;
				rdlen = rdlen + len;
				Console.WriteLine&#40;"&#123;0&#125; bytes processed", rdlen&#41;;
			&#125;
 
			encStream.Close&#40;&#41;;  
			fout.Close&#40;&#41;;
			fin.Close&#40;&#41;;                   
		&#125;