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.$nonce,$key,true); $mac2=eval('return hex2bin(\$valuemac);'); $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 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BBJ9L
function name:  (null)
number of ops:  27
compiled vars:  !0 = $lemessage, !1 = $mac, !2 = $valuemac, !3 = $nonce, !4 = $key, !5 = $mac2, !6 = $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  $8      
          4        ASSIGN                                                   !1, $8
   25     5        INIT_FCALL                                               'hash_hmac'
          6        SEND_VAL                                                 'sha512'
          7        CONCAT                                           ~10     !0, !3
          8        SEND_VAL                                                 ~10
          9        SEND_VAR                                                 !4
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $11     
         12        ASSIGN                                                   !2, $11
   29    13        INCLUDE_OR_EVAL                                  $13     'return+hex2bin%28%5C%24valuemac%29%3B', EVAL
         14        ASSIGN                                                   !5, $13
   31    15        INIT_FCALL                                               'mac'
         16        SEND_VAR                                                 !5
         17        DO_FCALL                                      0  $15     
         18        ASSIGN                                                   !6, $15
   32    19        IS_EQUAL                                                 !1, !6
         20      > JMPZ                                                     ~17, ->23
   34    21    >   ECHO                                                     'OK'
         22      > JMP                                                      ->24
   37    23    >   ECHO                                                     'KO'
   41    24    >   ECHO                                                     !1
   42    25        ECHO                                                     !6
         26      > 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/BBJ9L
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:
158.42 ms | 1394 KiB | 19 Q