note 36374 added to function.mcrypt-encrypt

From: Date: Tue, 07 Oct 2003 21:03:01 +0000
Subject: note 36374 added to function.mcrypt-encrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-57981@lists.php.net to get a copy of this message
If you are getting the following errors on you apache log file: PHP Fatal error: Call to undefined function: mcrypt_module_open() in ... you can use he following functions to accomplish the same thing. The only downside is that the super secret key may be shown by your ps command ... Google for OpenSSL and base64 to find their current locations. Mine came from http://www.openssl.org and http://www.fourmilab.ch/webtools/base64/. Cheers! <? function grEncrypt($plain_text) { $cmd = "echo {$plain_text}|openssl bf -e -nosalt -k keyToYourSecret|base64 -e"; $encrypted = chop($cmd); return $encrypted; } function grDecrypt($plain_text) { $cmd = "echo {$plain_text}| base64 -d|openssl bf -d -nosalt -k keyToYourSecret"; $decrypted_data = $cmd; return $decrypted_data; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.mcrypt-encrypt.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36374 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36374&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36374&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#57981) next »