note 36374 deleted from function.mcrypt-encrypt by derick
| From: | derick@php.net | Date: | Sat, 17 Jan 2004 21:00:45 +0000 |
| Subject: | note 36374 deleted from function.mcrypt-encrypt by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63749@lists.php.net to get a copy of this message | ||
Note Submitter: opedroso at swoptimizer dot com
----
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;
}
?>