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="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; $mac = mac($lemessage); $valuemac=hash_hmac("sha512","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5uc3m01","7h3_1337_k3y",true); print("**".strlen($valuemac)."***".$valuemac."*******"); $mac2=eval('return hex2bin("c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477");'); $packed=pack('c*',"c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477"); print("EEEEEEE".$packed."AAAAEEE"); $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 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ig8fn
function name:  (null)
number of ops:  40
compiled vars:  !0 = $lemessage, !1 = $mac, !2 = $valuemac, !3 = $mac2, !4 = $packed, !5 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
   23     1        INIT_FCALL                                               'mac'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $7      
          4        ASSIGN                                                   !1, $7
   25     5        INIT_FCALL                                               'hash_hmac'
          6        SEND_VAL                                                 'sha512'
          7        SEND_VAL                                                 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5uc3m01'
          8        SEND_VAL                                                 '7h3_1337_k3y'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
   26    12        STRLEN                                           ~11     !2
         13        CONCAT                                           ~12     '%2A%2A', ~11
         14        CONCAT                                           ~13     ~12, '%2A%2A%2A'
         15        CONCAT                                           ~14     ~13, !2
         16        CONCAT                                           ~15     ~14, '%2A%2A%2A%2A%2A%2A%2A'
         17        ECHO                                                     ~15
   29    18        INCLUDE_OR_EVAL                                  $16     'return+hex2bin%28%22c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477%22%29%3B', EVAL
         19        ASSIGN                                                   !3, $16
   31    20        INIT_FCALL                                               'pack'
         21        SEND_VAL                                                 'c%2A'
         22        SEND_VAL                                                 'c210825a47af7f8869fb6e11adc9dd3eceb85735c47807badaff958f0af386f5e3f7e24c15034ff6dc71d117697f5853da05bb76ec7086d07f25b53f707d9477'
         23        DO_ICALL                                         $18     
         24        ASSIGN                                                   !4, $18
   32    25        CONCAT                                           ~20     'EEEEEEE', !4
         26        CONCAT                                           ~21     ~20, 'AAAAEEE'
         27        ECHO                                                     ~21
   35    28        INIT_FCALL                                               'mac'
         29        SEND_VAR                                                 !3
         30        DO_FCALL                                      0  $22     
         31        ASSIGN                                                   !5, $22
   36    32        IS_EQUAL                                                 !1, !5
         33      > JMPZ                                                     ~24, ->36
   38    34    >   ECHO                                                     'OK'
         35      > JMP                                                      ->37
   41    36    >   ECHO                                                     'KO'
   45    37    >   ECHO                                                     !1
   46    38        ECHO                                                     !5
         39      > 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/Ig8fn
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:
157.56 ms | 1403 KiB | 21 Q