Galera usei o seguinte código para testar o mcrypt:
<?php /* * PHP mcrypt - Basic encryption and decryption of a string */ $string = "hugoborges"; $secret_key = "dt4239#e%@13ffdg!3%$^%*"; // Create the initialization vector for added security. $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); // Encrypt $string $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secret_key, $string, MCRYPT_MODE_CBC, $iv); // Decrypt $string $decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $secret_key, $encrypted_string, MCRYPT_MODE_CBC, $iv); echo "Original string : " . $string . "<br />\n"; echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string : " . $decrypted_string . "<br />\n"; ?>
E retorna este erro:
Warning: mcrypt_encrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /Applications/XAMPP/xamppfiles/htdocs/CoÌpia de 1.php on line 12 Warning: mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /Applications/XAMPP/xamppfiles/htdocs/CoÌpia de 1.php on line 15 Original string : hugoborges Encrypted string : Decrypted string :
Dei uma olhada no meu phpinfo(); e parece tudo ok:
Alguém sabe o que esta errado?