6

I am encrypting large file sizes (>1GB) using AES encryption with a key size of 256 and over a 1000 hash iterations. To make the program memory efficient I'm reading the file from the stream, chunk by chunk (of specific buffer lengths) and encrypting them.

However, to encrypt a file of roughly 1GB it just takes me ~6 secs on a Mac with 16GB memory and 2.2 GHz i7 processor. Is it normal that it takes only this much time? Or should I be concerned? does it usually take longer? Or (as I read) is it given AES's quality to be fast?

Any help in understanding the scenario will be appreciated.

Thank You

Shabirmean
  • 163
  • 1
  • 1
  • 4

1 Answers1

12

From this answer Different ways/algorithms for implementing AES you can see that AES is already pretty fast. By using the hardware instruction you can even get down to $\sim1.3$ cycles/byte[1].

$1 GB = 2^{30} B \approx 10^9 B$

Your CPU is working at $2.2$ GHz, in other word $2.2 \times 10^9$ cycles per second. To encrypt $1 GB$ you need $1.3 \times 2^{30}$ cycles. In other word, it would take $\frac{1.3 \times 2^{30}}{2.2 \times 10^9} = 0.634$ seconds. So clearly AES is super fast.

read more:

Biv
  • 10,088
  • 2
  • 42
  • 68