Facebook
From ja, 9 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 329
  1. RijndaelManaged AES = ConfigureEncryption(password, salt);
  2. using (FileStream nowyPlik = new FileStream(inputFileName + ".aes", FileMode.Create))
  3. {
  4.     nowyPlik.Write(salt, 0, salt.Length);
  5.     using (CryptoStream szyfrowanie = new CryptoStream(nowyPlik, AES.CreateEncryptor(),
  6.     CryptoStreamMode.Write))
  7.     {
  8.         using (FileStream plikDoZaszyfrowania = new FileStream(inputFileName, FileMode.Open))
  9.         {
  10.             byte[] buffer = new byte[1048576];
  11.             int read;
  12.             while ((read = plikDoZaszyfrowania.Read(buffer, 0, buffer.Length)) > 0)
  13.             {
  14.                 szyfrowanie.Write(buffer, 0, read);
  15.             }
  16.         }
  17.     }
  18. }