The given examples below are dummy and in English. They are mainly for place holding as this is a concept question rather specific example based

Given AES has a block size of 128 bit (16 letters of English) and assume I am using the 128 bit key version without an IV.

Assume I have the plaintext hellohowareyoutodayihopeyouareok and the key 1234567890123456

If i take the first section of the plaintext hellohowareyouto and run the encryption on it with the above key and get the ciphertext 111erqsdgdisa222 and later we run the plaintext dayihopeyouareok with the same key we get the ciphertext 333isdisiodfi444.

My question is, given the cipher works on blocks of size 128 bit, if we take the entire plaintext hellohowareyoutodayihopeyouareok and encrypt it with the same key, would we get 111erqsdgdisa222333isdisiodfi444 ?

If no, why not? (Given the IV is constant, or no IV exists, given not all encryption algorithms require and IV. The story of having a fixed IV for all encryption being a bad idea is a different topic and not the aim of this question)


1 Answer 1


Yes this would work as stated by you.


If you're using a library supporting ECB (which you are actually using in this example) you can input the whole 32 bytes of plaintext and will receive the corresponding 32 bytes of ciphertext. Splitting the operation into two calls doesn't make any difference for libraries as internally they do nothing else than simply calling the encryption function for each block and concatenating the ciphertext to get the output.

Standard note:

Do not use the encryption mode proposed by you (ECB) in the "real world".
Rather use GCM or an other authenticated encryption mode as you also have to check if your data was altered and came from the correct source.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.