Size of data after AES/CBC and AES/ECB encryption

AES has a fixed block size of 16 bytes regardless of key size. Assuming you use PKCS 5/7 padding, use this formula:

 cipherLen = (clearLen/16 + 1) * 16;

Please note that if the clear-text is a multiple of the block size then a whole new block is needed for padding. For example, if your clear-text is 16 bytes then the cipher-text will take 32 bytes.

You might want to store the IV (Initial Vector) with the cipher-text. In that case, you need to add 16 more bytes for the IV.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)