note 51067 added to ref.mcrypt

From: Date: Fri, 18 Mar 2005 16:37:03 +0000
Subject: note 51067 added to ref.mcrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-86628@lists.php.net to get a copy of this message
I was creating a cross-platform (unix + windows) application and ran into some issues with different versions of mcrypt (2.4.x vs 2.5.x) not working with Windows. After further investigation, I found the following: Libmcrypt 2.5.7 is not usable with PHP 4.x. The reason is a very Windows-specific issue. DLLs are Windows' way of providing shared code - things get loaded once into RAM and are guaranteed identical across all applications that use them. When an application references a routine/function in a DLL, it may do so either by function name or by reference number. Referring to a routine by name is considered slow by some people and does slow down the startup of applications that use large numbers of routines in DLLs (applications such as PHP). Referring to a routine by reference number is very quick but breaks if a new DLL version changes the reference number assignments for its routines. Libmcrypt 2.5.6 & 7's DLLs do not have the same reference number assignments as old Libmcrypt.dll files did. Specifically, function 148 (mdecrypt_generic) has been moved in 2.5.6/7 to number 149 due to the addition of the mcrypt_mutex_register function which moved everything above it alphebetically up a reference number. PHP's php_mcrypt.dll, which provides the PHP language bindings to the low-level Libmcrypt.dll, refers to Libmcrypt.dll's functions by number instead of name. PHP 4.x's php_mcrypt.dll refers to function 148 while PHP 5.0's php_mcrypt.dll refers to function 149 and notes that PHP 5.0 under Windows can only work with Libmcrypt 2.5.6 and higher (because function 149 in old Libmcrypt is actually the Panama encryption algorithm, not the expected mcrypt_generic routine). So, unless you can find a PHP 4.x php_mcrypt.dll that has been compiled for Libmcrypt 2.5.6 and higher, PHP 4.x won't be able to decrypt data with Libmcrypt 2.5.7 under Windows. ---- Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51067 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51067&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51067&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51067&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51067&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51067&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51067&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86628) next »