Facebook
From ja1, 2 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 327
  1. RijndaelManaged AES = ConfigureEncryption(password, salt);
  2. using (FileStream plikZaszyfrowany = new FileStream(inputFileName, FileMode.Open))
  3. {
  4.     plikZaszyfrowany.Read(salt, 0, salt.Length);
  5.  
  6.     using (CryptoStream odszyfrowywanie = new CryptoStream(plikZaszyfrowany,
  7.  
  8.     AES.CreateDecryptor(), CryptoStreamMode.Read))
  9.     {
  10.         using (FileStream plikNieZaszyfrowany = new FileStream(outputFileName,
  11.  
  12.         FileMode.Create))
  13.         {
  14.             byte[] buffer = new byte[1048576];
  15.             int read;
  16.             while ((read = odszyfrowywanie.Read(buffer, 0, buffer.Length)) > 0)
  17.             {
  18.                 plikNieZaszyfrowany.Write(buffer, 0, read);
  19.             }
  20.         }
  21.     }
  22. }