3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startsWith($haystack, $needle) { return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE; } function find_dec_prefix($str) { $i = 0; for(;;$i++) { $newstr = $str . $i; $hash = sha1($newstr); if($hash[0] == '0' && $hash[1] == 'e') { // echo "Found it: [" . $newstr . "] " . $hash . "\n"; // echo "subs: " . substr($hash, 2) . "\n"; if(!preg_match("/[a-f]/", substr($hash, 2))) { echo "doesn't contain a-f: $hash\n"; return $newstr; } } } } $pass1 = find_dec_prefix("suPERSecretPasSw0rD"); $pass2 = find_dec_prefix("omgDONTcollidePLEASE"); var_dump(sha1($pass1) == sha1($pass2)); echo(sha1('aaroZmOk') . " - " . sha1('aaK1STfY') . "\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1seIK
function name:  (null)
number of ops:  29
compiled vars:  !0 = $pass1, !1 = $pass2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'find_dec_prefix'
          1        SEND_VAL                                                 'suPERSecretPasSw0rD'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   22     4        INIT_FCALL                                               'find_dec_prefix'
          5        SEND_VAL                                                 'omgDONTcollidePLEASE'
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !1, $4
   24     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'sha1'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $6      
         12        INIT_FCALL                                               'sha1'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $7      
         15        IS_EQUAL                                         ~8      $6, $7
         16        SEND_VAL                                                 ~8
         17        DO_ICALL                                                 
   25    18        INIT_FCALL                                               'sha1'
         19        SEND_VAL                                                 'aaroZmOk'
         20        DO_ICALL                                         $10     
         21        CONCAT                                           ~11     $10, '+-+'
         22        INIT_FCALL                                               'sha1'
         23        SEND_VAL                                                 'aaK1STfY'
         24        DO_ICALL                                         $12     
         25        CONCAT                                           ~13     ~11, $12
         26        CONCAT                                           ~14     ~13, '%0A'
         27        ECHO                                                     ~14
         28      > RETURN                                                   1

Function startswith:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/1seIK
function name:  startsWith
number of ops:  15
compiled vars:  !0 = $haystack, !1 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        IS_IDENTICAL                                     ~2      !1, ''
          3      > JMPNZ_EX                                         ~2      ~2, ->13
          4    >   INIT_FCALL                                               'strrpos'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        STRLEN                                           ~3      !0
          8        MUL                                              ~4      ~3, -1
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        TYPE_CHECK                                  1018  ~6      $5
         12        BOOL                                             ~2      ~6
         13    > > RETURN                                                   ~2
    4    14*     > RETURN                                                   null

End of function startswith

Function find_dec_prefix:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 3
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 3
Branch analysis from position: 33
Branch analysis from position: 3
Branch analysis from position: 31
Branch analysis from position: 15
filename:       /in/1seIK
function name:  find_dec_prefix
number of ops:  34
compiled vars:  !0 = $str, !1 = $i, !2 = $newstr, !3 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 0
    7     2      > JMP                                                      ->32
    8     3    >   CONCAT                                           ~5      !0, !1
          4        ASSIGN                                                   !2, ~5
    9     5        INIT_FCALL                                               'sha1'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   10     9        FETCH_DIM_R                                      ~9      !3, 0
         10        IS_EQUAL                                         ~10     ~9, '0'
         11      > JMPZ_EX                                          ~10     ~10, ->15
         12    >   FETCH_DIM_R                                      ~11     !3, 1
         13        IS_EQUAL                                         ~12     ~11, 'e'
         14        BOOL                                             ~10     ~12
         15    > > JMPZ                                                     ~10, ->31
   13    16    >   INIT_FCALL                                               'preg_match'
         17        SEND_VAL                                                 '%2F%5Ba-f%5D%2F'
         18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !3
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $13     
         22        SEND_VAR                                                 $13
         23        DO_ICALL                                         $14     
         24        BOOL_NOT                                         ~15     $14
         25      > JMPZ                                                     ~15, ->31
   14    26    >   ROPE_INIT                                     3  ~17     'doesn%27t+contain+a-f%3A+'
         27        ROPE_ADD                                      1  ~17     ~17, !3
         28        ROPE_END                                      2  ~16     ~17, '%0A'
         29        ECHO                                                     ~16
   15    30      > RETURN                                                   !2
    7    31    >   PRE_INC                                                  !1
         32    > > JMPNZ                                                    <true>, ->3
   19    33    > > RETURN                                                   null

End of function find_dec_prefix

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.74 ms | 1407 KiB | 25 Q