From: stjeffy at hotmail dot com Operating system: windows 2000,linux PHP version: 4.3.2 PHP Bug Type: mcrypt related Bug description: 3des keys length
Description: ------------ I work with mcrypt to encrypt the string by Triple DES. But I meet with the key length problem. I use a 24BYTE key, the key is(HEX)3FD3A3DABD10B0FF6EAFB5A0103D386EAF6E3F8CAED6CD93 After executing a instance, the system reports the following error: mcrypt_generic_init(): Key size too large; supplied length: 48, max: 24 in and cut off the half of the original key to calculate the 3des result. And I find there exists the same problem in php.net' online help-- the 2nd example provided in http://www.php.net/manual/en/ref.mcrypt.php. Reproduce code: --------------- $strSource = "http://www.php.net/test.php"; $strKey = "3FD3A3DABD10B0FF6EAFB5A0103D386EAF6E3F8CAED6CD93"; $td = mcrypt_module_open (MCRYPT_3DES, '', 'ecb', ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); mcrypt_generic_init ($td, $strKey, $iv); $strCode = mcrypt_generic ($td, $strSource); mcrypt_generic_end ($td); echo base64_encode($strCode); Expected result: ---------------- w6e8c9Tp0/PejfYYvgJJu3cHUXYg29CQAthGmi480Ng= Actual result: -------------- LMke4PuG37H9vP5gvRoVwQkX0hZrtfE9NB/az+lSLcc= -- Edit bug report at http://bugs.php.net/?id=26283&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26283&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26283&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26283&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26283&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26283&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26283&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26283&r=support Expected behavior: http://bugs.php.net/fix.php?id=26283&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26283&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26283&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26283&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26283&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26283&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26283&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26283&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26283&r=float