3v4l.org

run code in 300+ PHP versions simultaneously
<?php // generate random string given length function genString($length = 22){ $s = ''; $chars = array_merge(range('A','Z'), range('a','z'), range(0,9)); while($length > 0){ $randKey = array_rand($chars, 1); $s .= $chars[$randKey]; $length--; } return $s; } $prefix = (PHP_VERSION_ID >= 50307) ? '$2y$' : '$2a$'; $salt = $prefix.genString(); //echo 'Salt: '.$salt.'<br>'; $password = 'password'; $hash = crypt($password, $salt); echo 'Strlen: '.strlen($hash).' ------ '; if (crypt($password, $hash) == $hash) { echo "Password verified!"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 3
Branch analysis from position: 1
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
Branch analysis from position: 26
filename:       /in/eHWrC
function name:  (null)
number of ops:  27
compiled vars:  !0 = $prefix, !1 = $salt, !2 = $password, !3 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > JMPZ                                                     <true>, ->3
          1    >   QM_ASSIGN                                        ~4      '%242y%24'
          2      > JMP                                                      ->4
          3    >   QM_ASSIGN                                        ~4      '%242a%24'
          4    >   ASSIGN                                                   !0, ~4
   16     5        INIT_FCALL                                               'genstring'
          6        DO_FCALL                                      0  $6      
          7        CONCAT                                           ~7      !0, $6
          8        ASSIGN                                                   !1, ~7
   20     9        ASSIGN                                                   !2, 'password'
   21    10        INIT_FCALL                                               'crypt'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   23    15        STRLEN                                           ~12     !3
         16        CONCAT                                           ~13     'Strlen%3A+', ~12
         17        CONCAT                                           ~14     ~13, '+------+'
         18        ECHO                                                     ~14
   25    19        INIT_FCALL                                               'crypt'
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $15     
         23        IS_EQUAL                                                 !3, $15
         24      > JMPZ                                                     ~16, ->26
   26    25    >   ECHO                                                     'Password+verified%21'
   27    26    > > RETURN                                                   1

Function genstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 21
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 21
Branch analysis from position: 31
Branch analysis from position: 21
filename:       /in/eHWrC
function name:  genString
number of ops:  33
compiled vars:  !0 = $length, !1 = $s, !2 = $chars, !3 = $randKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                        !0      22
    5     1        ASSIGN                                                   !1, ''
    6     2        INIT_FCALL                                               'array_merge'
          3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 'A'
          5        SEND_VAL                                                 'Z'
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        INIT_FCALL                                               'range'
          9        SEND_VAL                                                 'a'
         10        SEND_VAL                                                 'z'
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        INIT_FCALL                                               'range'
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 9
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                         $8      
         19        ASSIGN                                                   !2, $8
    7    20      > JMP                                                      ->29
    8    21    >   INIT_FCALL                                               'array_rand'
         22        SEND_VAR                                                 !2
         23        SEND_VAL                                                 1
         24        DO_ICALL                                         $10     
         25        ASSIGN                                                   !3, $10
    9    26        FETCH_DIM_R                                      ~12     !2, !3
         27        ASSIGN_OP                                     8          !1, ~12
   10    28        PRE_DEC                                                  !0
    7    29    >   IS_SMALLER                                               0, !0
         30      > JMPNZ                                                    ~15, ->21
   12    31    > > RETURN                                                   !1
   13    32*     > RETURN                                                   null

End of function genstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.1 ms | 1402 KiB | 22 Q