Reputation: 165
I am encrypting data using AES 256 encryption, want to know how can i restrict length of the encrypted text. if i encrypt 6 character string using AES 256 it gets encrypted around 100 character. I want to add this data in table so wanted to know the maximum length so that i can set constraint in table in php codeigniter.
$this->encryption->initialize(
array(
'cipher' => 'aes-256',
'mode' => 'ECB',
'key' => $key1
)
);
$this->encryption->encrypt($_POST['uname']);
Upvotes: 1
Views: 2420
Reputation: 112855
Best guess given minimal information is that you are treating encrypted data as a null terminated character string and since the encryption does not null terminate the encrypted data the null terminator is something that just happens to be in memory falling the encrypted data.
The following assume AES in ECB mode.
Upvotes: 1