php_dev7 Posted July 1, 2009 Share Posted July 1, 2009 I'm having some problem on using 3DES encryption in PHP 5.2.9. I have followed all the steps to configure mcrypt in php.ini file.I have removed the ; from the extensions extension=php_mcrypt.dll and i also made a copy/paste of libmcrypt.dll from the folder php to C:/WINDOWS/system32/.I have restarted the Webserver Apache but when i tried to encrypt data using encrypt and decrypt function created in php code i'm having the error message below:Call to undefined function mcrypt_module_open() . Could you kindly help me to resolve this problem? Below you will find the code that i used : </html> <head><title>Encryption</title> </head> <body> <form name=form method=post action='encrypt.php'> <table align=center> <TR><TD>Source Text:</TD><TD><input type=text name=input value=<?php echo $_REQUEST['input']; ?>></TD></TR> <TR><TD>Key:</TD><TD><input type=text name=key value=<?php echo $_REQUEST['key']; ?>></TD></TR> </table> <input type=submit> </form> <?php if(!empty($_REQUEST['input'])){ $encrypted=encrypt($_REQUEST['input']); $decrypted=decrypt($encrypted); echo "Encrypted : '$encrypted' Decrypted: '$decrypted' <BR>"; } $key = $_REQUEST['key']; //Encrypt Function function encrypt($encrypt) { global $key; $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt, MCRYPT_MODE_ECB, $iv); $encode = base64_encode($passcrypt); return $encode; } //Decrypt Function function decrypt($decrypt) { global $key; $decoded = base64_decode($decrypt); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $decoded, MCRYPT_MODE_ECB, $iv); return $decrypted; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/164387-problem-with-mcrypt-function-in-php-529/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.