# AES encryption takes more time to decrypt than encrypt

Please let me know if this is not the right place to ask this question. I will remove it.

I am trying to find how much time an AES encryption and decryption takes for a given amount of data and key. In all the cases encryption takes way lesser processing time than decryption. I tried to get this answer somewhere else but can't find. May I know why does decryption takes a lot more time than encryption for AES 128/256 bit?

Added information: I am trying to implement a simple AES encryption in Arduino UNO. And used micros() to measure the time it takes to encrypt or decrypt. Here is what I did for encryption:

Serial.print("Encrypted: "); unsigned long start1 = micros(); String enc = aes_encrypt("this is data source","this is key"); Serial.println(enc); unsigned long start2 = micros(); unsigned long diff1 = start2 - start1; Serial.print("Time to encrypt the data: "); Serial.print(diff1); Serial.println(" microseconds");

-
This is going to depend extremely highly on your implementation, choice of mode, etc. There is not enough information in the question to provide an answer. –  Stephen Touset Mar 13 at 20:39
Thanks @StephenTouset, tried to add some more info if it helps. –  Bee Mar 13 at 21:07
The edit doesn't seem to actually provide any information about the actual library or the encryption mode you're using. –  Stephen Touset Mar 13 at 21:13
If round keys are not precomputed for decryption, they must be "inverted" at runtime, which will slow down decryption substantially (assuming common AES implementation that uses inverted round keys, speed can be reduced to half of encryption). Decrypt modes of operation can also be slower, more information is required. –  Richie Frame Mar 14 at 3:07
Also, if it is performing 8-bit multiplications instead of a table lookup, decrypt will take up to 6 times longer, since there are up to 12 $GF(2^8)$ multiplications per word, vs 2 on encrypt (in a mixcolumns operation using only X2 multiplication). The alternative is to use a table based lookup, but those require a hell of a lot more RAM –  Richie Frame Mar 14 at 3:28