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); print("**".strlen($valuemac)."***".$valuemac."*******"); $mac2=eval('return hex2bin("c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477");'); $packed=pack("C*",80,72,80); print("EEEEEEE".$packed."AAAAEEE"); $b=mac($mac2); if($mac==$b) { print("OK"); } else{ print("KO"); } $test1 = "OhMyG05h!OhMyG05h!OhMyG05h!OhMyG05h!OhMyG05h!OhMyG05h!OhMyG05h!O"; $test2 = crypt($test1,'$6$rounds=5000$OhMyG05h!'); print("%%%%%%%%%%%%%%%%%%".$test2."%%%%%%%%%%%%%%%%%%%%%%%%%%"); print($mac); print($b);
based on YRLDu
Output for 5.4.10 - 7.2.0
cas3**64***��ZG��i�n���>θW5�x���� ���LO��q�iXS��v�p��%�?p}�w*******EEEEEEEPHPAAAAEEEcas2OK%%%%%%%%%%%%%%%%%%$6$rounds=5000$OhMyG05h!$4jZShUTQrfvoVlfMFenH1p1phvwoE1qj1Jm9sGjx.pSzIDFioyenZMOoqRXM0UNoAYXrc8lciSc9W5sStFXPm1%%%%%%%%%%%%%%%%%%%%%%%%%%$6$rounds=5000$OhMyG05h!$EVaV8jNGJn8deADd3yFF1E6Tcm1h.WDrVgwAGWzd/HMjLYAmMLNx4aPdShsP0sIpDzfLc.SHHnSoW779gxLSt0$6$rounds=5000$OhMyG05h!$EVaV8jNGJn8deADd3yFF1E6Tcm1h.WDrVgwAGWzd/HMjLYAmMLNx4aPdShsP0sIpDzfLc.SHHnSoW779gxLSt0
Output for 5.3.20 - 5.3.29
cas3**64***��ZG��i�n���>θW5�x���� ���LO��q�iXS��v�p��%�?p}�w******* Fatal error: Call to undefined function hex2bin() in /in/Op6T7(29) : eval()'d code on line 1
Process exited with code 255.