3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mymodule_decrypt_value($string) { // Si es una cadena vacía no hay nada que hacer if (empty($string)) { return FALSE; } $key ="12EstaClave34es56dificil489ssswf"; $iv ="Imphartoz.37hAES"; if (empty($key)) { watchdog('mymodule', 'No hay una clave para descifrar.', array(), WATCHDOG_ERROR); return FALSE; } if (empty($iv)) { watchdog('mymodule', 'No hay un vector de inicialización para descifrar.', array(), WATCHDOG_ERROR); return FALSE; } $plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($string), MCRYPT_MODE_CBC, $iv); // Eliminar el padding return mymodule_unpadPKCS7($plaintext_dec); } function mymodule_unpadPKCS7($data) { $last = substr($data, -1); return substr($data, 0, strlen($data) - ord($last)); } mymodule_decrypt_value("V36B+ya6eMwElOoxswqGBw=="); echo "<h1>Hello, PHP!</h1>"; ?>

preferences:
40.99 ms | 402 KiB | 5 Q