Relation between input and ciphertext length in AES

后端 未结 3 1072
隐瞒了意图╮
隐瞒了意图╮ 2020-12-25 14:13

Having recently started using cryptography in my application, I find myself puzzled by the relationship between the input text length and the ciphertext it results in. Befor

3条回答
  •  有刺的猬
    2020-12-25 14:32

    From my understanding, in block modes (cbc, ecb) output length will be rounded to the block size, as returned by mcrypt_enc_get_block_size. Plus, you need to store IV along with the data, so the size will be rounded strlen(data) + mcrypt_enc_get_iv_size().

    As for the base64 encoding, I wouldn't bother (but make sure to use hex encoding when dumping your db).

提交回复
热议问题