I have to save all data stored in table in encrypted form. In php codeigniter i found encryption library. i am using following code:-
$this->encryption->initialize(
array(
'driver' => 'openssl',
'cipher' => 'aes-256',
'mode' => 'ctr',
'key' => 'CKXH2U9RPY3EFD70TLS1ZG4N8WQBOVI6AMJ5'
)
);
$ciphertext = $this->encryption->encrypt($firstname);
echo $ciphertext;
echo $this->encryption->decrypt($ciphertext);
Challenge here is even if $firstname is 10 character , encrypted text is random and also the length vary each and everytime.
Is there any way i can restrict length of encrypted text and encrypted text be similar everytime.