ID: 27062
Updated by: sniper@php.net
Reported By: yu at csh dot dp dot ua
-Status: Open
+Status: Assigned
Bug Type: mcrypt related
Operating System: Windows 2000
PHP Version: 4.3.4
-Assigned To:
+Assigned To: derick
New Comment:
It's ZTS issue, I bet. Try a bit harder, Derick..
Previous Comments:
------------------------------------------------------------------------
[2004-01-27 15:47:42] derick@php.net
Works fine for me on Linux.
------------------------------------------------------------------------
[2004-01-27 13:16:58] yu at csh dot dp dot ua
Description:
------------
Server is localhost.
Function mdecrypt_generic() doesn't decrypt anything.
Instead it returns value of the encrypted string without changing.
Crypt-library loaded from
http://ftp.emini.dk/pub/php/win32/mcrypt/libmcrypt.dll
, as specified
in the php_manual for mcrypt functions.
Same problem reports other users:
http://bugs.php.net/bug.php?id=3165&edit=2
- Bug #3165: encrypt/decrypt
not a function?
http://www.forbiddenweb.org/viewtopic.php?t=4556
here is another link to crypt-libraries, that point as functional:
http://ftp.proventum.net/pub/php/win32/misc/mcrypt/
, but i don't check it functionality.
Additionaly mcrypt_create_iv() produces same iv for every time script
is runing. But this not problem when, for example,
<?
...
$iv=substr(pack('h*',sha1(uniqid(rand())), 0,
mcrypt_enc_get_iv_size($td));
...
?>
Reproduce code:
---------------
<?php
#Example to mcrypt_module_open() from php_manual_ru.html
#almost without changes
srand();
$td = mcrypt_module_open('rijndael-256', '', 'cbc', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
$ks = mcrypt_enc_get_key_size($td);
$key = substr(md5('very secret key'), 0, $ks);
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, 'This is my data');
mcrypt_generic_deinit($td);
mcrypt_generic_init($td, $key, $iv);
$decrypted = mdecrypt_generic($td, $encrypted);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
echo trim($decrypted) . "\n";?>
Expected result:
----------------
"This is my data"
Actual result:
--------------
$encrypted value
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27062&edit=1