3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function mac($msg) { $key = "7h3_1337_k3y"; $nonce = "5uc3m01"; $bloc_size = 64; if(strlen($msg)==$bloc_size) { print("cas2"); $mac = $msg; } else if(strlen($msg)>$bloc_size) { print("cas3"); $mac = hash_hmac("sha512",$msg.$nonce,$key,true); } return crypt($mac,'$6$rounds=5000$OhMyG05h!'); } $lemessage="UNMESSAGEASSEZGRANDPOURTOMBERDANSLECASDUCALCULDEHASHMAPETPOUVOIRREJOURSONMACPOURTOMBERDANSLECASCRYPTODIRECT"; $mac = mac($lemessage); $valuemac=hash_hmac("sha512",$lemessage."5uc3m01","7h3_1337_k3y",true); $mac2=eval("return hex2bin($valuemac);"); $b=mac($mac2); if($mac==$b) { print("OK"); } else{ print("KO"); } print($mac); print($b);
based on cLb1j
Output for 7.1.0 - 7.2.0
cas3 Warning: Unexpected character in input: '' (ASCII=16) state=0 in /in/mEg3N(29) : eval()'d code on line 1 Parse error: syntax error, unexpected '�ZG�' (T_STRING), expecting ',' or ')' in /in/mEg3N(29) : eval()'d code on line 1
Process exited with code 255.
Output for 7.0.0 - 7.0.20
cas3 Warning: Unexpected character in input: '' (ASCII=16) state=0 in /in/mEg3N(29) : eval()'d code on line 1 Parse error: syntax error, unexpected '�ZG��i�n' (T_STRING), expecting ',' or ')' in /in/mEg3N(29) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.11 - 5.6.28
cas3 Warning: Unexpected character in input: '' (ASCII=16) state=0 in /in/mEg3N(29) : eval()'d code on line 1 Parse error: syntax error, unexpected '�ZG��i�n' (T_STRING) in /in/mEg3N(29) : eval()'d code on line 1 Notice: Undefined variable: mac in /in/mEg3N on line 19 KO$6$rounds=5000$OhMyG05h!$EVaV8jNGJn8deADd3yFF1E6Tcm1h.WDrVgwAGWzd/HMjLYAmMLNx4aPdShsP0sIpDzfLc.SHHnSoW779gxLSt0$6$rounds=5000$OhMyG05h!$dbl6sUoiavNEU9p7fZlQR5wHf7889FFmGBnT2lrna2RZv1IHq7Ws5eG4g6GVoZXi2dqATfp3eTnJbLMBxlw/Y/
Output for 5.4.10
cas3 Warning: Unexpected character in input: '' (ASCII=16) state=0 in /in/mEg3N(29) : eval()'d code on line 1 Parse error: syntax error, unexpected '�ZG��i�n' (T_STRING) in /in/mEg3N(29) : eval()'d code on line 1 Notice: Undefined variable: mac in /in/mEg3N on line 19 KO$6$rounds=5000$OhMyG05h!$EVaV8jNGJn8deADd3yFF1E6Tcm1h.WDrVgwAGWzd/HMjLYAmMLNx4aPdShsP0sIpDzfLc.SHHnSoW779gxLSt0$6$rounds=5000$OhMyG05h!$dbl6sUoiavNEU9p7fZlQR5wHf7889FFmGBnT2lrna2RZv1IHq7Ws5eG4g6GVoZXi2dqATfp3eTnJbLMBxlw/Y/
Process exited with code 255.
Output for 5.3.20 - 5.3.29
cas3 Warning: Unexpected character in input: '' (ASCII=16) state=0 in /in/mEg3N(29) : eval()'d code on line 1 Parse error: syntax error, unexpected T_STRING in /in/mEg3N(29) : eval()'d code on line 1 Notice: Undefined variable: mac in /in/mEg3N on line 19 KO$6$rounds=5000$OhMyG05h!$EVaV8jNGJn8deADd3yFF1E6Tcm1h.WDrVgwAGWzd/HMjLYAmMLNx4aPdShsP0sIpDzfLc.SHHnSoW779gxLSt0$6$rounds=5000$OhMyG05h!$dbl6sUoiavNEU9p7fZlQR5wHf7889FFmGBnT2lrna2RZv1IHq7Ws5eG4g6GVoZXi2dqATfp3eTnJbLMBxlw/Y/
Process exited with code 255.