title: What is the problem of increasing the time encryption of my stream cipher algorithm?
body: <p>I have my own stream cipher algorithm, and I made a comparison between it and AES performance. I tested it on several files with different sizes(to 500KB). Its encryption/decryption time is less than AES for files about 500KB. but with files more than 500KB, its encryption time  is more than AES but still its decryption time is the least one.</p>
  
  <pre><code>public static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes)
  {
      byte[] encryptedBytes = null;
  
      byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  
      using (MemoryStream ms = new MemoryStream())
      {
          using (RijndaelManaged AES = new RijndaelManaged())
      {
              AES.KeySize = 128;
              AES.BlockSize = 128;
              var key = new Rfc2898DeriveBytes(passwordBytes, 
              saltBytes, 1000);
              AES.Key = key.GetBytes(AES.KeySize / 8);
              AES.IV = key.GetBytes(AES.BlockSize / 8);
              AES.Padding = PaddingMode.Zeros;
              AES.Mode = CipherMode.CFB;
  
              using (var cs = new CryptoStream(ms, 
              AES.CreateEncryptor(), CryptoStreamMode.Write))
              {
                  cs.Write(bytesToBeEncrypted, 0, 
                  bytesToBeEncrypted.Length);
                  cs.Close();
              }
              encryptedBytes = ms.ToArray();
          }
          ms.Close();
      }
  
      return encryptedBytes;
  }
  
  public static byte[] AES_Decrypt(byte[] bytesToBeDecrypted, byte[] passwordBytes)
  {
      byte[] decryptedBytes = null;
      byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  
      using (MemoryStream ms = new MemoryStream())
      {
          using (RijndaelManaged AES = new RijndaelManaged())
          {
              AES.KeySize = 128;
              AES.BlockSize = 128;
              var key = new Rfc2898DeriveBytes(passwordBytes, 
        saltBytes, 1000);
              AES.Key = key.GetBytes(AES.KeySize / 8);
              AES.IV = key.GetBytes(AES.BlockSize / 8);
              AES.Padding = PaddingMode.Zeros;
              AES.Mode = CipherMode.CFB;                      
  
              using (var cs = new CryptoStream(ms, 
             AES.CreateDecryptor(), CryptoStreamMode.Write))
              {
                  cs.Write(bytesToBeDecrypted, 0, 
                 bytesToBeDecrypted.Length);
                  cs.Close();
              }
              decryptedBytes = ms.ToArray();
          }
      }
  
      return decryptedBytes;
  }
  </code></pre>