shiza Posted April 22, 2012 Share Posted April 22, 2012 Error: call to undefined function mcrypt_module_open() I have copied this code form net. And i think so that mcrypt_module_open() would be a built in function. But I think it is not so. How can i define this function. OR any other way to solve this problem?? $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); printf("iv_size = %d\n",$iv_size); $key256 = '12345678901234561234567890123456'; $key128 = '1234567890123456'; $iv = '1234567890123456'; printf("iv: %s\n",bin2hex($iv)); printf("key256: %s\n",bin2hex($key256)); printf("key128: %s\n",bin2hex($key128)); $cleartext = 'The quick brown fox jumped over the lazy dog'; printf("plainText: %s\n\n",$cleartext); if (mcrypt_generic_init($cipher, $key256, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("256-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); } if (mcrypt_generic_init($cipher, $key128, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("128-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); } Thanks In advance Quote Link to comment https://forums.phpfreaks.com/topic/261424-call-to-undefined-function-mcrypt_module_open/ Share on other sites More sharing options...
litebearer Posted April 22, 2012 Share Posted April 22, 2012 did check the site where you got the code to see if they define the function? Quote Link to comment https://forums.phpfreaks.com/topic/261424-call-to-undefined-function-mcrypt_module_open/#findComment-1339610 Share on other sites More sharing options...
shiza Posted April 22, 2012 Author Share Posted April 22, 2012 No there wasn't. It is bulit-in or userdefined? Quote Link to comment https://forums.phpfreaks.com/topic/261424-call-to-undefined-function-mcrypt_module_open/#findComment-1339615 Share on other sites More sharing options...
litebearer Posted April 23, 2012 Share Posted April 23, 2012 Take a look here, it may be of some help... http://www.issociate.de/board/post/401160/Fatal_error:_Call_to_undefined_function_mcrypt_module_open%28%29.html Quote Link to comment https://forums.phpfreaks.com/topic/261424-call-to-undefined-function-mcrypt_module_open/#findComment-1339713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.