3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hasher($info, $encdata = false) { $strength = "08"; //if encrypted data is passed, check it against input ($info) if ($encdata) { if (substr($encdata, 0, 60) == crypt($info, "$2a$".$strength."$".substr($encdata, 60))) { return true; } else { return false; } } else { //make a salt and hash it with input, and add salt to end $salt = ""; for ($i = 0; $i < 22; $i++) { $salt .= substr("./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", mt_rand(0, 63), 1); } //return 82 char string (60 char hash & 22 char salt) return crypt($info, "$2a$".$strength."$".$salt).$salt; } } if ('$2a$08$EtdOmTznraimrGNl0uZiPecrPugD5HeOc4yAGd.Kx/gx2vmCUmC7SEtdOmTznraimrGNl0uZiPl' == hasher('tylko', '$2a$08$EtdOmTznraimrGNl0uZiPecrPugD5HeOc4yAGd.Kx/gx2vmCUmC7SEtdOmTznraimrGNl0uZiPl')) { echo 'sss'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/9Ruhk
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'hasher'
          1        SEND_VAL                                                 'tylko'
          2        SEND_VAL                                                 '%242a%2408%24EtdOmTznraimrGNl0uZiPecrPugD5HeOc4yAGd.Kx%2Fgx2vmCUmC7SEtdOmTznraimrGNl0uZiPl'
          3        DO_FCALL                                      0  $0      
          4        IS_EQUAL                                                 $0, '%242a%2408%24EtdOmTznraimrGNl0uZiPecrPugD5HeOc4yAGd.Kx%2Fgx2vmCUmC7SEtdOmTznraimrGNl0uZiPl'
          5      > JMPZ                                                     ~1, ->7
   26     6    >   ECHO                                                     'sss'
   27     7    > > RETURN                                                   1

Function hasher:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 29
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 29
Branch analysis from position: 42
Branch analysis from position: 29
filename:       /in/9Ruhk
function name:  hasher
number of ops:  52
compiled vars:  !0 = $info, !1 = $encdata, !2 = $strength, !3 = $salt, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    4     2        ASSIGN                                                   !2, '08'
    6     3      > JMPZ                                                     !1, ->26
    7     4    >   INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 60
          8        DO_ICALL                                         $6      
          9        INIT_FCALL                                               'crypt'
         10        SEND_VAR                                                 !0
         11        CONCAT                                           ~7      '%242a%24', !2
         12        CONCAT                                           ~8      ~7, '%24'
         13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 60
         16        DO_ICALL                                         $9      
         17        CONCAT                                           ~10     ~8, $9
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                         $11     
         20        IS_EQUAL                                                 $6, $11
         21      > JMPZ                                                     ~12, ->24
    8    22    > > RETURN                                                   <true>
         23*       JMP                                                      ->25
   11    24    > > RETURN                                                   <false>
         25*       JMP                                                      ->51
   16    26    >   ASSIGN                                                   !3, ''
   17    27        ASSIGN                                                   !4, 0
         28      > JMP                                                      ->40
   18    29    >   INIT_FCALL                                               'substr'
         30        SEND_VAL                                                 '.%2FABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
         31        INIT_FCALL                                               'mt_rand'
         32        SEND_VAL                                                 0
         33        SEND_VAL                                                 63
         34        DO_ICALL                                         $15     
         35        SEND_VAR                                                 $15
         36        SEND_VAL                                                 1
         37        DO_ICALL                                         $16     
         38        ASSIGN_OP                                     8          !3, $16
   17    39        PRE_INC                                                  !4
         40    >   IS_SMALLER                                               !4, 22
         41      > JMPNZ                                                    ~19, ->29
   21    42    >   INIT_FCALL                                               'crypt'
         43        SEND_VAR                                                 !0
         44        CONCAT                                           ~20     '%242a%24', !2
         45        CONCAT                                           ~21     ~20, '%24'
         46        CONCAT                                           ~22     ~21, !3
         47        SEND_VAL                                                 ~22
         48        DO_ICALL                                         $23     
         49        CONCAT                                           ~24     $23, !3
         50      > RETURN                                                   ~24
   23    51*     > RETURN                                                   null

End of function hasher

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.79 ms | 1407 KiB | 20 Q