3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function encrypt_3DES($message, $key){ // Se establece un IV por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map("chr", $bytes)); //PHP 4 >= 4.0.2 // Se cifra $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv); //PHP 4 >= 4.0.2 return $ciphertext; } function encodeBase64($data){ $data = base64_encode($data); return $data; } function decodeBase64($data){ $data = base64_decode($data); return $data; } function mac256($ent,$key){ $res = hash_hmac('sha256', $ent, $key, true);//(PHP 5 >= 5.1.2) return $res; } function createMerchantSignature($key){ // Se decodifica la clave Base64 $key = decodeBase64($key); // Se genera el parámetro Ds_MerchantParameters $ent = ""; // Se diversifica la clave con el Número de Pedido $key = encrypt_3DES('1442772645', $key); // MAC256 del parámetro Ds_MerchantParameters $res = mac256($ent, $key); // Se codifican los datos Base64 return encodeBase64($res); } $key = createMerchantSignature("Mk9m98IfEblmPfrpsawt7BmxObt98Jev"); echo $key ?>
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() in /in/vXut9:11 Stack trace: #0 /in/vXut9(34): encrypt_3DES('1442772645', '2Of\xF7\xC2\x1F\x11\xB9f=\xFA\xE9\xB1\xAC-...') #1 /in/vXut9(41): createMerchantSignature('2Of\xF7\xC2\x1F\x11\xB9f=\xFA\xE9\xB1\xAC-...') #2 {main} thrown in /in/vXut9 on line 11
Process exited with code 255.
Output for 5.4.10 - 5.5.34, 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
KydOcZJLvoo7ruprb+XtS2D8dX0mz64bBmgqdUAolv8=
Output for 5.3.20 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_encrypt() in /in/vXut9 on line 11
Process exited with code 255.