Hi
We need to cipher users' files in our application.
The following is an encryption prototype method (in the real life it will accept an input stream). It is straightforward but we are not fully satisfied with the performance of this sample and considering changing the method used.
Is it possible to squeeze out some seconds from this code?
private static void EncryptFile(string fileName, string encryptedFileName, byte[] key, byte[] iv)
{
using (RijndaelManaged rijndael = new RijndaelManaged {Key = key, IV = iv})
{
using (FileStream outFile = new FileStream(encryptedFileName, FileMode.CreateNew, FileAccess.Write, FileShare.None))
{
using (CryptoStream cryptoStream = new CryptoStream(outFile, rijndael.CreateEncryptor(), CryptoStreamMode.Write))
{
using (FileStream inFile = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
{
byte[] buffer = new byte[bufferSi ...
Go to the complete details ...