AES and CBC in PHP
- by Kane
I am trying to encrypt a string in php using AES-128 and CBC, but when I call mcrypt_generic_init() it returns false.
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '',MCRYPT_MODE_CBC, '');
$iv_size = mcrypt_enc_get_iv_size($cipher);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$res = mcrypt_generic_init($cipher, 'aaaa', $iv); //'aaaa' is a…