Re: [PHP] mcrypt don't work.
On Sun, 2004-02-08 at 05:18, [EMAIL PROTECTED] wrote: > Hi all, > I have problem with mcrypt function. > There is always an error that I don't know how to correct this. > This is my code: > > $string = "Text string"; > $key= "My key"; > $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); > echo"stringa cifrata= $encrypted"; > $key = "My key"; > $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); > echo"stringa decifrata= $string"; If you are using mycrypt 2.4.x you need to do something like this: encrypt: # initialize the encryption module $mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, ''); mcrypt_generic_init($mc_module, $encryption_key, $iv); # encrypt the data $encrypted_data = mcrypt_generic($mc_module, $data); # de-initialize the encryption module mcrypt_generic_deinit($mc_module); mcrypt_module_close($mc_module); decrypt: # initialize the encryption module $mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, ''); mcrypt_generic_init($mc_module, $encryption_key, $iv); # decrypt the data $decrypted_data = mdecrypt_generic($mc_module, $encrypted_data); # trim any trailing \0, encrypted data is automatically padded to a 32byte boundary with \0 $decrypted_data = rtrim($decrypted_data); # de-initialize the encryption module mcrypt_generic_deinit($mc_module); mcrypt_module_close($mc_module); Check the documentation[1] for more information on encryption keys and initialization vectors. [1] http://www.php.net/mcrypt -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt don't work.
Mmm this same problem happen to me also... I use Apache 1.3.29 for Win32 and PHP v4.3.4 ... I do not know why but mcrypt module failed to initialize [EMAIL PROTECTED] wrote: Hi all, I have problem with mcrypt function. There is always an error that I don't know how to correct this. This is my code: $string = "Text string"; $key= "My key"; $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); echo"stringa cifrata= $encrypted"; $key = "My key"; $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); echo"stringa decifrata= $string"; And the errore message is Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 58 stringa decifrata= I see, with phpinfo(), that my server support mcrypt and RIJNDAEL-256. I don't know why there is this error message. All helps are precious. Thanks in advance Francesco [EMAIL PROTECTED] (P.S. this is the link for a view in real time of the problem www.automationsoft.biz/critto.php) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt don't work.
Hi all, I have problem with mcrypt function. There is always an error that I don't know how to correct this. This is my code: $string = "Text string"; $key= "My key"; $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); echo"stringa cifrata= $encrypted"; $key = "My key"; $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); echo"stringa decifrata= $string"; And the errore message is Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 58 stringa decifrata= I see, with phpinfo(), that my server support mcrypt and RIJNDAEL-256. I don't know why there is this error message. All helps are precious. Thanks in advance Francesco [EMAIL PROTECTED] (P.S. this is the link for a view in real time of the problem www.automationsoft.biz/critto.php)
Re: [PHP] mcrypt don't work.
Have you tried to check if PHP has been compiled with mcrypt? try this on a page Look for mcrypt directives, if not there you need to download it and compile it like so. http://mcrypt.sourceforge.net Get both the libmcrypt and mcrypt compressed archives from command prompt on linux... cd /path/to/libmcrypt.xx.tar.gz gzip -dfrv libmcrypt.xx.tar.gz tar -xvf libmcrypt.xx.tar cd libmcrypt.xx/ ./config --disable-posix-threads make make install now do the same for mcrypt cd /path/to/mcrypt.xx.tar.gz gzip -dfrv mcrypt.xx.tar.gz tar -xvf mcrypt.xx.tar cd mcrypt.xx/ ./config --disable-posix-threads make make install now you need to compile php for mcrypt support cd /path/to/php-4.xx ./configure --with-mcrypt=/path/to/libmcrypt/ make make install simple, now if your using apache on windows you need to get the windows executables from mcrypt.sourceforge.net Also if mcrypt is already installed simple do a find find / | grep libmcrypt from a command prompt to find the libraries, if you cannot find it them install it, or just re-compile php to include support. Hope this helps, it took me awhile to figure it out too. Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt don't work.
Francesco, mcrypt_ functions rely on a PHP extension, your syntax look ok, PHP is telling you that it could not load the required extension (module). the following page from the PHP manual tells more about what you need in order to use mcrypt_ functions: http://nl2.php.net/manual/en/ref.mcrypt.php I also noticed that you are trying to use the IDEA encryption algorithm; afaik this is only free for use non-commercial use... although you may not care ;-) [EMAIL PROTECTED] wrote: Hi all, i've problem with mcrypt_cfb function. This is the code: $string = "A simple text string"; $key = "My key"; line 55: $encrypted = mcrypt_cfb(MCRYPT_IDEA, $key, $string, MCRYPT_ENCRYPT); $key = "My key"; line 59: $string = mcrypt_cfb(MCRYPT_IDEA, $key, $encrypted, MCRYPT_DECRYPT); I've alway this error message: Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 59 stringa decifrata= and I don't know where is the problem.. Is the sintax correct? I see mcrypt function in PHP manual at www.php.net but I don't find the problem. Can you explain me how use mcrypt function? All helps are precious. Thanks in advance. Frank [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt don't work.
Hi all, i've problem with mcrypt_cfb function. This is the code: $string = "A simple text string"; $key = "My key"; line 55: $encrypted = mcrypt_cfb(MCRYPT_IDEA, $key, $string, MCRYPT_ENCRYPT); $key = "My key"; line 59: $string = mcrypt_cfb(MCRYPT_IDEA, $key, $encrypted, MCRYPT_DECRYPT); I've alway this error message: Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 59 stringa decifrata= and I don't know where is the problem.. Is the sintax correct? I see mcrypt function in PHP manual at www.php.net but I don't find the problem. Can you explain me how use mcrypt function? All helps are precious. Thanks in advance. Frank [EMAIL PROTECTED]