ID: 29172 Updated by: [EMAIL PROTECTED] Reported By: lars at larswolter dot de Status: Open Bug Type: mcrypt related Operating System: Windows PHP Version: 5.0.0 New Comment:
Works fine for me on Linux, I saw this bug before and then it was a Windows issue too. I don't have a development setup for Windows here so I can't really help to track down this problem. Previous Comments: ------------------------------------------------------------------------ [2004-07-15 01:47:06] lars at larswolter dot de Description: ------------ Just changed from php4 to php5. Now mcrypt decryption does not work anymore. The function returns the encrypted data instead of the decrypted. The testcode is the example from the mdecrypt_generic function documentation. using php.ini-recommended and only changed the following display_errors = On display_startup_errors = On extensions_dir = ... loaded extra modules: gd2, mbstring, mcrypt, mysql, exif Reproduce code: --------------- <?php $key = 'this is a very long key...'; $plain_text = 'very important data'; $td = mcrypt_module_open('des', '', 'ecb',''); $key = substr($key, 0, mcrypt_enc_get_key_size($td)); $iv_size = mcrypt_enc_get_iv_size($td); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); if (mcrypt_generic_init($td, $key, $iv) != -1) { $c_t = mcrypt_generic($td, $plain_text); mcrypt_generic_deinit($td); mcrypt_generic_init($td, $key, $iv); $p_t = mdecrypt_generic($td, $c_t); mcrypt_generic_deinit($td); mcrypt_module_close($td); } if (strncmp($p_t, $plain_text, strlen($plain_text)) == 0) echo "ok"; else echo "error"; ?> Expected result: ---------------- the result should be: ok Actual result: -------------- the result is: error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29172&edit=1