3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Op6T7
function name:  (null)
number of ops:  52
compiled vars:  !0 = $lemessage, !1 = $mac, !2 = $valuemac, !3 = $mac2, !4 = $packed, !5 = $b, !6 = $test1, !7 = $test2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, 'UNMESSAGEASSEZGRANDPOURTOMBERDANSLECASDUCALCULDEHASHMAPETPOUVOIRREJOURSONMACPOURTOMBERDANSLECASCRYPTODIRECT'
   23     1        INIT_FCALL                                               'mac'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $9      
          4        ASSIGN                                                   !1, $9
   25     5        INIT_FCALL                                               'hash_hmac'
          6        SEND_VAL                                                 'sha512'
          7        CONCAT                                           ~11     !0, '5uc3m01'
          8        SEND_VAL                                                 ~11
          9        SEND_VAL                                                 '7h3_1337_k3y'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !2, $12
   26    13        STRLEN                                           ~14     !2
         14        CONCAT                                           ~15     '%2A%2A', ~14
         15        CONCAT                                           ~16     ~15, '%2A%2A%2A'
         16        CONCAT                                           ~17     ~16, !2
         17        CONCAT                                           ~18     ~17, '%2A%2A%2A%2A%2A%2A%2A'
         18        ECHO                                                     ~18
   29    19        INCLUDE_OR_EVAL                                  $19     'return+hex2bin%28%22c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477%22%29%3B', EVAL
         20        ASSIGN                                                   !3, $19
   31    21        INIT_FCALL                                               'pack'
         22        SEND_VAL                                                 'C%2A'
         23        SEND_VAL                                                 80
         24        SEND_VAL                                                 72
         25        SEND_VAL                                                 80
         26        DO_ICALL                                         $21     
         27        ASSIGN                                                   !4, $21
   32    28        CONCAT                                           ~23     'EEEEEEE', !4
         29        CONCAT                                           ~24     ~23, 'AAAAEEE'
         30        ECHO                                                     ~24
   35    31        INIT_FCALL                                               'mac'
         32        SEND_VAR                                                 !3
         33        DO_FCALL                                      0  $25     
         34        ASSIGN                                                   !5, $25
   36    35        IS_EQUAL                                                 !1, !5
         36      > JMPZ                                                     ~27, ->39
   38    37    >   ECHO                                                     'OK'
         38      > JMP                                                      ->40
   41    39    >   ECHO                                                     'KO'
   43    40    >   ASSIGN                                                   !6, 'OhMyG05h%21OhMyG05h%21OhMyG05h%21OhMyG05h%21OhMyG05h%21OhMyG05h%21OhMyG05h%21O'
   44    41        INIT_FCALL                                               'crypt'
         42        SEND_VAR                                                 !6
         43        SEND_VAL                                                 '%246%24rounds%3D5000%24OhMyG05h%21'
         44        DO_ICALL                                         $29     
         45        ASSIGN                                                   !7, $29
   45    46        CONCAT                                           ~31     '%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25', !7
         47        CONCAT                                           ~32     ~31, '%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25'
         48        ECHO                                                     ~32
   47    49        ECHO                                                     !1
   48    50        ECHO                                                     !5
         51      > RETURN                                                   1

Function mac:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/Op6T7
function name:  mac
number of ops:  28
compiled vars:  !0 = $msg, !1 = $key, !2 = $nonce, !3 = $bloc_size, !4 = $mac
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '7h3_1337_k3y'
    6     2        ASSIGN                                                   !2, '5uc3m01'
    7     3        ASSIGN                                                   !3, 64
    9     4        STRLEN                                           ~8      !0
          5        IS_EQUAL                                                 !3, ~8
          6      > JMPZ                                                     ~9, ->10
   11     7    >   ECHO                                                     'cas2'
   12     8        ASSIGN                                                   !4, !0
          9      > JMP                                                      ->22
   14    10    >   STRLEN                                           ~11     !0
         11        IS_SMALLER                                               !3, ~11
         12      > JMPZ                                                     ~12, ->22
   16    13    >   ECHO                                                     'cas3'
   17    14        INIT_FCALL                                               'hash_hmac'
         15        SEND_VAL                                                 'sha512'
         16        CONCAT                                           ~13     !0, !2
         17        SEND_VAL                                                 ~13
         18        SEND_VAR                                                 !1
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $14     
         21        ASSIGN                                                   !4, $14
   19    22    >   INIT_FCALL                                               'crypt'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 '%246%24rounds%3D5000%24OhMyG05h%21'
         25        DO_ICALL                                         $16     
         26      > RETURN                                                   $16
   20    27*     > RETURN                                                   null

End of function mac

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.04 ms | 1407 KiB | 21 Q