libmcrypt

From: Date: Tue, 22 Oct 2002 22:08:36 +0000
Subject: libmcrypt
Groups: php.general 
Request: Send a blank email to php-general+get-120993@lists.php.net to get a copy of this message
Hello, I've followed an article on libmcrypt by W.J. Gilmore on onlamp.com. I have installed libmcrypt, reconfigured - make - make install php and restarted apache. phpinfo shows mcrypt is available. But, trying the example from the article I get this: [22-Oct-2002 14:51:53] PHP Fatal error: Call to undefined function: mcrypt_create_iv() in /home/bryank/public_html/encrypt.php on line 12 Any ideas on what might be wrong here? Thanks, Bryan here is the script: <?php // Designate string to be encrypted $string = "Applied Cryptography, by Bruce Schneier, is a wonderful cryptography reference."; // Encryption/decryption key $key = "Four score and twenty years ago"; // Encryption Algorithm $cipher_alg = MCRYPT_RIJNDAEL_128; // Create the initialization vector for added security. $iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg, MCRYPT_MODE_ECB), MCRYPT_RAND); // Output original string print "Original string: $string <p>"; // Encrypt $string $encrypted_string = mcrypt_encrypt($cipher_alg, $key, $string, MCRYPT_MODE_CBC, $iv); // Convert to hexadecimal and output to browser print "Encrypted string: ".bin2hex($encrypted_string)."<p>"; $decrypted_string = mcrypt_decrypt($cipher_alg, $key, $encrypted_string, MCRYPT_MODE_CBC, $iv); print "Decrypted string: $decrypted_string"; ?>

« previous php.general (#120993) next »