# How long does a good AES encryption take?

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

• My computer processes AES-128 at 3GB/s Commented Mar 22, 2017 at 2:03
• @RichieFrame - So it's not an abnormal behaviour? It's an acceptable thing is it? Commented Mar 22, 2017 at 2:17
• AES itself is very fast. Your 'over a 1000 hash iterations' suggests you are using a Password-Based encryption scheme, which is different from plain AES. The Password-Based Key Derivation step should be relatively slow; that's what the iteration count is for, although in the last two decades there are now PBKD schemes that are much safer than a plain iterated hash. Commented Mar 22, 2017 at 3:01
• CAUTION: most likely 1000 hash iterations is not enough. These likely are for key stretching, perhaps PBKDF2 or similar, or iterating a standard hash. Since you find that 6 seconds is acceptable, you can probably spend 1 second at key stretching, and with proper implementation we are talking orders of magnitude more that 1000 hash iterations!
– fgrieu
Commented Mar 22, 2017 at 9:46

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.