|  | Posted by Gordan on 06/20/05 13:46 
mysql> select aes_encrypt('gordan', 'abc');+------------------------------+
 | aes_encrypt('gordan', 'abc') |
 +------------------------------+
 | p§Θb9??_ι?0φ?LIέ             |
 +------------------------------+
 
 I would like to "emulate" that function in PHP. I know that MySQL AES algorithm
 is RIJNDAEL_128 so I tried the following code
 <?php
 $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
 $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
 echo mcrypt_ecb (MCRYPT_RIJNDAEL_128, 'abc', 'gordan', MCRYPT_MODE_CBC,
 $iv);
 ?>
 
 but the encrypted string is different from the MySQL one :-(
 and ideas?
 
 thanks,
 gordan
  Navigation: [Reply to this message] |