note 26574 added to ref.mcrypt

From: Date: Tue, 05 Nov 2002 16:25:24 +0000
Subject: note 26574 added to ref.mcrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-38998@lists.php.net to get a copy of this message
The statement that use of the 'generic' functions is 'recommended' in 2.4+ should probably be 'required'. Having like many others struggled with a "mcrypt module initialization failed" error even when phpinfo() showed mcrypt installed and all its algorithms loaded, I found that: $key = mcrypt_ecb (MCRYPT_3DES, $magic, $input, MCRYPT_ENCRYPT); fails, but $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); mcrypt_generic_init ($td, $magic, $iv); $key = mcrypt_generic ($td, $input); mcrypt_generic_end ($td); works fine. You can't leave out the creation of the IV to the right length, even though ECB doesn't use it (happily, because I want it repeatable). I have to say 1 self-explanatory line into 5 lines (one of which is pointless) to do the same thing doesn't seem like progress! -- http://www.php.net/manual/en/ref.mcrypt.php http://master.php.net/manage/user-notes.php?action=edit+26574 http://master.php.net/manage/user-notes.php?action=delete+26574 http://master.php.net/manage/user-notes.php?action=reject+26574

« previous php.notes (#38998) next »