3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myhash(string $pwd): string { // Use md5 to make sure arbitrary length passwords are represented fully and not truncated. return password_hash(md5($pwd, true), PASSWORD_BCRYPT); } function myverify(string $pwd, string $hash): bool { return password_verify(md5($pwd, true), $hash); } var_dump(md5('mj'), md5('oq')); $hash = myhash('mj'); // Original password 'mj' is not the same as attack password 'oq', but they verify. var_dump(myverify('oq', $hash));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6tunp
function name:  (null)
number of ops:  22
compiled vars:  !0 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'md5'
          2        SEND_VAL                                                 'mj'
          3        DO_ICALL                                         $1      
          4        SEND_VAR                                                 $1
          5        INIT_FCALL                                               'md5'
          6        SEND_VAL                                                 'oq'
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   14    10        INIT_FCALL                                               'myhash'
         11        SEND_VAL                                                 'mj'
         12        DO_FCALL                                      0  $4      
         13        ASSIGN                                                   !0, $4
   17    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'myverify'
         16        SEND_VAL                                                 'oq'
         17        SEND_VAR                                                 !0
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function myhash:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6tunp
function name:  myhash
number of ops:  13
compiled vars:  !0 = $pwd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'password_hash'
          2        INIT_FCALL                                               'md5'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        SEND_VAL                                                 '2y'
          8        DO_ICALL                                         $2      
          9        VERIFY_RETURN_TYPE                                       $2
         10      > RETURN                                                   $2
    6    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function myhash

Function myverify:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6tunp
function name:  myverify
number of ops:  14
compiled vars:  !0 = $pwd, !1 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_FCALL                                               'password_verify'
          3        INIT_FCALL                                               'md5'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $3      
         10        VERIFY_RETURN_TYPE                                       $3
         11      > RETURN                                                   $3
   10    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function myverify

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.83 ms | 1407 KiB | 23 Q