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",false); print("**".strlen($valuemac)."***".$valuemac."*******"); $mac2=eval('return hex2bin("c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477");'); $b=mac($mac2); if($mac==$b) { print("OK"); } else{ print("KO"); } print($mac); print($b);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3q7bB
function name:  (null)
number of ops:  33
compiled vars:  !0 = $lemessage, !1 = $mac, !2 = $valuemac, !3 = $mac2, !4 = $b
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  $6      
          4        ASSIGN                                                   !1, $6
   25     5        INIT_FCALL                                               'hash_hmac'
          6        SEND_VAL                                                 'sha512'
          7        CONCAT                                           ~8      !0, '5uc3m01'
          8        SEND_VAL                                                 ~8
          9        SEND_VAL                                                 '7h3_1337_k3y'
         10        SEND_VAL                                                 <false>
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !2, $9
   26    13        STRLEN                                           ~11     !2
         14        CONCAT                                           ~12     '%2A%2A', ~11
         15        CONCAT                                           ~13     ~12, '%2A%2A%2A'
         16        CONCAT                                           ~14     ~13, !2
         17        CONCAT                                           ~15     ~14, '%2A%2A%2A%2A%2A%2A%2A'
         18        ECHO                                                     ~15
   29    19        INCLUDE_OR_EVAL                                  $16     'return+hex2bin%28%22c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477%22%29%3B', EVAL
         20        ASSIGN                                                   !3, $16
   31    21        INIT_FCALL                                               'mac'
         22        SEND_VAR                                                 !3
         23        DO_FCALL                                      0  $18     
         24        ASSIGN                                                   !4, $18
   32    25        IS_EQUAL                                                 !1, !4
         26      > JMPZ                                                     ~20, ->29
   34    27    >   ECHO                                                     'OK'
         28      > JMP                                                      ->30
   37    29    >   ECHO                                                     'KO'
   41    30    >   ECHO                                                     !1
   42    31        ECHO                                                     !4
         32      > 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/3q7bB
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:
149.73 ms | 1403 KiB | 19 Q