3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doHash($string) { if ($string == "") return ""; $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $hashChars = "0123456789ABCDEF"; $hashedString = ""; $hashArray = Array(32); for($i=0; $i<32; $i++) $hashArray[$i]=GetCharacterKey($string, $i); print_r($hashArray); for ($i=0; $i<32; $i++) { if (strpos($passwordChars, substr($string, $i%strlen($string), 1)) == -1) $string= substr($string, 0, $i%strlen($string)) . "_" . substr($string, ($i%strlen($string))+1, (strlen($string)-($i%strlen($string)))-1); $hashArray[$i] += (floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))/9)*16 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%9/3)*4 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%3)); for ($j=0; $j<3; $j++) if (($hashArray[$i]&(48>>($j*2))) == (32>>($j*2)) && (GetCharacterKey($string, $i)&(1<<$j))==(1<<$j)) $hashArray[i]=($hashArray[$i]&(255-(48>>($j*2)))) + (48>>($j*2)); for ($j=0; $j<2; $j++) $hashArray[$i] += floor($hashArray[($i+$j)%32]/1234)*pow(4,$j+3); $doubleByteHashNumber = 0; for ($j=0; $j<16; $j++) $doubleByteHashNumber += (($hashArray[$i]&pow(2,($j*2)+($i%2)))>>($j+($i%2))); $hashArray[$i] = $doubleByteHashNumber; $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)/16), 1); $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)%16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)/16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)%16), 1); } return $hashedString; } function GetCharacterKey($string, $character) { // echo $character . "\n\n "; $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $key = strpos($passwordChars, $string[$character%strlen($string)]); for($i=0; $i<10+strlen($string)+($character*3); $i++) { // echo $key . " "; $key = ($key<<1); // echo $key . " "; $key %= 2147483648; //echo $key . " >> " . $string[$i%strlen($string)] . " "; $key += strpos($passwordChars, $string[$i%strlen($string)]); // echo $key . " "; $key = floor(sin($key)*1000000); // echo $key . "\n"; } // echo "\n"; // Modified to support x64 machines. $key &= 4294967232; return $key; if ($key < 0) { return -(2147483648 - ($key & 2147483584)); } else { return ($key & 2147483584); } } echo GetCharacterKey("c",0) . "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ea7IN
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   INIT_FCALL                                               'getcharacterkey'
          1        SEND_VAL                                                 'c'
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        CONCAT                                           ~1      $0, '%0A'
          5        ECHO                                                     ~1
   63     6      > RETURN                                                   1

Function dohash:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 10
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 238
Branch analysis from position: 238
2 jumps found. (Code = 44) Position 1 = 240, Position 2 = 24
Branch analysis from position: 240
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 60
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 144
Branch analysis from position: 144
2 jumps found. (Code = 44) Position 1 = 146, Position 2 = 114
Branch analysis from position: 146
1 jumps found. (Code = 42) Position 1 = 164
Branch analysis from position: 164
2 jumps found. (Code = 44) Position 1 = 166, Position 2 = 148
Branch analysis from position: 166
1 jumps found. (Code = 42) Position 1 = 183
Branch analysis from position: 183
2 jumps found. (Code = 44) Position 1 = 185, Position 2 = 169
Branch analysis from position: 185
2 jumps found. (Code = 44) Position 1 = 240, Position 2 = 24
Branch analysis from position: 240
Branch analysis from position: 24
Branch analysis from position: 169
2 jumps found. (Code = 44) Position 1 = 185, Position 2 = 169
Branch analysis from position: 185
Branch analysis from position: 169
Branch analysis from position: 148
2 jumps found. (Code = 44) Position 1 = 166, Position 2 = 148
Branch analysis from position: 166
Branch analysis from position: 148
Branch analysis from position: 114
2 jumps found. (Code = 46) Position 1 = 122, Position 2 = 131
Branch analysis from position: 122
2 jumps found. (Code = 43) Position 1 = 132, Position 2 = 143
Branch analysis from position: 132
2 jumps found. (Code = 44) Position 1 = 146, Position 2 = 114
Branch analysis from position: 146
Branch analysis from position: 114
Branch analysis from position: 143
Branch analysis from position: 131
Branch analysis from position: 60
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 10
Branch analysis from position: 19
Branch analysis from position: 10
filename:       /in/Ea7IN
function name:  doHash
number of ops:  242
compiled vars:  !0 = $string, !1 = $passwordChars, !2 = $hashChars, !3 = $hashedString, !4 = $hashArray, !5 = $i, !6 = $j, !7 = $doubleByteHashNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        IS_EQUAL                                                 !0, ''
          2      > JMPZ                                                     ~8, ->4
          3    > > RETURN                                                   ''
    7     4    >   ASSIGN                                                   !1, 'abcdefghijklmnopqrstuvwxyz_'
    8     5        ASSIGN                                                   !2, '0123456789ABCDEF'
    9     6        ASSIGN                                                   !3, ''
   10     7        ASSIGN                                                   !4, <array>
   11     8        ASSIGN                                                   !5, 0
          9      > JMP                                                      ->17
         10    >   INIT_FCALL_BY_NAME                                       'GetCharacterKey'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !5
         13        DO_FCALL                                      0  $15     
         14        ASSIGN_DIM                                               !4, !5
         15        OP_DATA                                                  $15
         16        PRE_INC                                                  !5
         17    >   IS_SMALLER                                               !5, 32
         18      > JMPNZ                                                    ~17, ->10
   13    19    >   INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                                 
   15    22        ASSIGN                                                   !5, 0
         23      > JMP                                                      ->238
   17    24    >   INIT_FCALL                                               'strpos'
         25        SEND_VAR                                                 !1
         26        INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !0
         28        STRLEN                                           ~20     !0
         29        MOD                                              ~21     !5, ~20
         30        SEND_VAL                                                 ~21
         31        SEND_VAL                                                 1
         32        DO_ICALL                                         $22     
         33        SEND_VAR                                                 $22
         34        DO_ICALL                                         $23     
         35        IS_EQUAL                                                 $23, -1
         36      > JMPZ                                                     ~24, ->60
         37    >   INIT_FCALL                                               'substr'
         38        SEND_VAR                                                 !0
         39        SEND_VAL                                                 0
         40        STRLEN                                           ~25     !0
         41        MOD                                              ~26     !5, ~25
         42        SEND_VAL                                                 ~26
         43        DO_ICALL                                         $27     
         44        CONCAT                                           ~28     $27, '_'
         45        INIT_FCALL                                               'substr'
         46        SEND_VAR                                                 !0
         47        STRLEN                                           ~29     !0
         48        MOD                                              ~30     !5, ~29
         49        ADD                                              ~31     ~30, 1
         50        SEND_VAL                                                 ~31
         51        STRLEN                                           ~32     !0
         52        STRLEN                                           ~33     !0
         53        MOD                                              ~34     !5, ~33
         54        SUB                                              ~35     ~32, ~34
         55        SUB                                              ~36     ~35, 1
         56        SEND_VAL                                                 ~36
         57        DO_ICALL                                         $37     
         58        CONCAT                                           ~38     ~28, $37
         59        ASSIGN                                                   !0, ~38
   18    60    >   INIT_FCALL                                               'floor'
         61        INIT_FCALL                                               'strpos'
         62        SEND_VAR                                                 !1
         63        INIT_FCALL                                               'substr'
         64        SEND_VAR                                                 !0
         65        STRLEN                                           ~41     !0
         66        MOD                                              ~42     !5, ~41
         67        SEND_VAL                                                 ~42
         68        SEND_VAL                                                 1
         69        DO_ICALL                                         $43     
         70        SEND_VAR                                                 $43
         71        DO_ICALL                                         $44     
         72        DIV                                              ~45     $44, 9
         73        SEND_VAL                                                 ~45
         74        DO_ICALL                                         $46     
         75        MUL                                              ~47     $46, 16
         76        INIT_FCALL                                               'floor'
         77        INIT_FCALL                                               'strpos'
         78        SEND_VAR                                                 !1
         79        INIT_FCALL                                               'substr'
         80        SEND_VAR                                                 !0
         81        STRLEN                                           ~48     !0
         82        MOD                                              ~49     !5, ~48
         83        SEND_VAL                                                 ~49
         84        SEND_VAL                                                 1
         85        DO_ICALL                                         $50     
         86        SEND_VAR                                                 $50
         87        DO_ICALL                                         $51     
         88        MOD                                              ~52     $51, 9
         89        DIV                                              ~53     ~52, 3
         90        SEND_VAL                                                 ~53
         91        DO_ICALL                                         $54     
         92        MUL                                              ~55     $54, 4
         93        ADD                                              ~56     ~47, ~55
         94        INIT_FCALL                                               'floor'
         95        INIT_FCALL                                               'strpos'
         96        SEND_VAR                                                 !1
         97        INIT_FCALL                                               'substr'
         98        SEND_VAR                                                 !0
         99        STRLEN                                           ~57     !0
        100        MOD                                              ~58     !5, ~57
        101        SEND_VAL                                                 ~58
        102        SEND_VAL                                                 1
        103        DO_ICALL                                         $59     
        104        SEND_VAR                                                 $59
        105        DO_ICALL                                         $60     
        106        MOD                                              ~61     $60, 3
        107        SEND_VAL                                                 ~61
        108        DO_ICALL                                         $62     
        109        ADD                                              ~63     ~56, $62
        110        ASSIGN_DIM_OP                +=               1          !4, !5
        111        OP_DATA                                                  ~63
   19   112        ASSIGN                                                   !6, 0
        113      > JMP                                                      ->144
        114    >   FETCH_DIM_R                                      ~65     !4, !5
        115        MUL                                              ~66     !6, 2
        116        SR                                               ~67     48, ~66
        117        BW_AND                                           ~68     ~65, ~67
        118        MUL                                              ~69     !6, 2
        119        SR                                               ~70     32, ~69
        120        IS_EQUAL                                         ~71     ~68, ~70
        121      > JMPZ_EX                                          ~71     ~71, ->131
        122    >   INIT_FCALL_BY_NAME                                       'GetCharacterKey'
        123        SEND_VAR_EX                                              !0
        124        SEND_VAR_EX                                              !5
        125        DO_FCALL                                      0  $72     
        126        SL                                               ~73     1, !6
        127        BW_AND                                           ~74     $72, ~73
        128        SL                                               ~75     1, !6
        129        IS_EQUAL                                         ~76     ~74, ~75
        130        BOOL                                             ~71     ~76
        131    > > JMPZ                                                     ~71, ->143
        132    >   FETCH_CONSTANT                                   ~77     'i'
        133        FETCH_DIM_R                                      ~79     !4, !5
        134        MUL                                              ~80     !6, 2
        135        SR                                               ~81     48, ~80
        136        SUB                                              ~82     255, ~81
        137        BW_AND                                           ~83     ~79, ~82
        138        MUL                                              ~84     !6, 2
        139        SR                                               ~85     48, ~84
        140        ADD                                              ~86     ~83, ~85
        141        ASSIGN_DIM                                               !4, ~77
        142        OP_DATA                                                  ~86
        143    >   PRE_INC                                                  !6
        144    >   IS_SMALLER                                               !6, 3
        145      > JMPNZ                                                    ~88, ->114
   20   146    >   ASSIGN                                                   !6, 0
        147      > JMP                                                      ->164
        148    >   INIT_FCALL                                               'floor'
        149        ADD                                              ~91     !5, !6
        150        MOD                                              ~92     ~91, 32
        151        FETCH_DIM_R                                      ~93     !4, ~92
        152        DIV                                              ~94     ~93, 1234
        153        SEND_VAL                                                 ~94
        154        DO_ICALL                                         $95     
        155        INIT_FCALL                                               'pow'
        156        SEND_VAL                                                 4
        157        ADD                                              ~96     !6, 3
        158        SEND_VAL                                                 ~96
        159        DO_ICALL                                         $97     
        160        MUL                                              ~98     $95, $97
        161        ASSIGN_DIM_OP                +=               1          !4, !5
        162        OP_DATA                                                  ~98
        163        PRE_INC                                                  !6
        164    >   IS_SMALLER                                               !6, 2
        165      > JMPNZ                                                    ~100, ->148
   21   166    >   ASSIGN                                                   !7, 0
   22   167        ASSIGN                                                   !6, 0
        168      > JMP                                                      ->183
        169    >   FETCH_DIM_R                                      ~103    !4, !5
        170        INIT_FCALL                                               'pow'
        171        SEND_VAL                                                 2
        172        MUL                                              ~104    !6, 2
        173        MOD                                              ~105    !5, 2
        174        ADD                                              ~106    ~104, ~105
        175        SEND_VAL                                                 ~106
        176        DO_ICALL                                         $107    
        177        BW_AND                                           ~108    $107, ~103
        178        MOD                                              ~109    !5, 2
        179        ADD                                              ~110    !6, ~109
        180        SR                                               ~111    ~108, ~110
        181        ASSIGN_OP                                     1          !7, ~111
        182        PRE_INC                                                  !6
        183    >   IS_SMALLER                                               !6, 16
        184      > JMPNZ                                                    ~114, ->169
   23   185    >   ASSIGN_DIM                                               !4, !5
        186        OP_DATA                                                  !7
   24   187        INIT_FCALL                                               'substr'
        188        SEND_VAR                                                 !2
        189        INIT_FCALL                                               'floor'
        190        FETCH_DIM_R                                      ~116    !4, !5
        191        BW_AND                                           ~117    ~116, 65280
        192        SR                                               ~118    ~117, 8
        193        DIV                                              ~119    ~118, 16
        194        SEND_VAL                                                 ~119
        195        DO_ICALL                                         $120    
        196        SEND_VAR                                                 $120
        197        SEND_VAL                                                 1
        198        DO_ICALL                                         $121    
        199        ASSIGN_OP                                     8          !3, $121
   25   200        INIT_FCALL                                               'substr'
        201        SEND_VAR                                                 !2
        202        INIT_FCALL                                               'floor'
        203        FETCH_DIM_R                                      ~123    !4, !5
        204        BW_AND                                           ~124    ~123, 65280
        205        SR                                               ~125    ~124, 8
        206        MOD                                              ~126    ~125, 16
        207        SEND_VAL                                                 ~126
        208        DO_ICALL                                         $127    
        209        SEND_VAR                                                 $127
        210        SEND_VAL                                                 1
        211        DO_ICALL                                         $128    
        212        ASSIGN_OP                                     8          !3, $128
   26   213        INIT_FCALL                                               'substr'
        214        SEND_VAR                                                 !2
        215        INIT_FCALL                                               'floor'
        216        FETCH_DIM_R                                      ~130    !4, !5
        217        BW_AND                                           ~131    ~130, 255
        218        DIV                                              ~132    ~131, 16
        219        SEND_VAL                                                 ~132
        220        DO_ICALL                                         $133    
        221        SEND_VAR                                                 $133
        222        SEND_VAL                                                 1
        223        DO_ICALL                                         $134    
        224        ASSIGN_OP                                     8          !3, $134
   27   225        INIT_FCALL                                               'substr'
        226        SEND_VAR                                                 !2
        227        INIT_FCALL                                               'floor'
        228        FETCH_DIM_R                                      ~136    !4, !5
        229        BW_AND                                           ~137    ~136, 255
        230        MOD                                              ~138    ~137, 16
        231        SEND_VAL                                                 ~138
        232        DO_ICALL                                         $139    
        233        SEND_VAR                                                 $139
        234        SEND_VAL                                                 1
        235        DO_ICALL                                         $140    
        236        ASSIGN_OP                                     8          !3, $140
   15   237        PRE_INC                                                  !5
        238    >   IS_SMALLER                                               !5, 32
        239      > JMPNZ                                                    ~143, ->24
   29   240    > > RETURN                                                   !3
   30   241*     > RETURN                                                   null

End of function dohash

Function getcharacterkey:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 13
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 13
Branch analysis from position: 39
Branch analysis from position: 13
filename:       /in/Ea7IN
function name:  GetCharacterKey
number of ops:  51
compiled vars:  !0 = $string, !1 = $character, !2 = $passwordChars, !3 = $key, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   35     2        ASSIGN                                                   !2, 'abcdefghijklmnopqrstuvwxyz_'
   36     3        INIT_FCALL                                               'strpos'
          4        SEND_VAR                                                 !2
          5        STRLEN                                           ~6      !0
          6        MOD                                              ~7      !1, ~6
          7        FETCH_DIM_R                                      ~8      !0, ~7
          8        SEND_VAL                                                 ~8
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !3, $9
   38    11        ASSIGN                                                   !4, 0
         12      > JMP                                                      ->33
   41    13    >   SL                                               ~12     !3, 1
         14        ASSIGN                                                   !3, ~12
   43    15        ASSIGN_OP                                     5          !3, 2147483648
   45    16        INIT_FCALL                                               'strpos'
         17        SEND_VAR                                                 !2
         18        STRLEN                                           ~15     !0
         19        MOD                                              ~16     !4, ~15
         20        FETCH_DIM_R                                      ~17     !0, ~16
         21        SEND_VAL                                                 ~17
         22        DO_ICALL                                         $18     
         23        ASSIGN_OP                                     1          !3, $18
   47    24        INIT_FCALL                                               'floor'
         25        INIT_FCALL                                               'sin'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $20     
         28        MUL                                              ~21     $20, 1000000
         29        SEND_VAL                                                 ~21
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !3, $22
   38    32        PRE_INC                                                  !4
         33    >   STRLEN                                           ~25     !0
         34        ADD                                              ~26     10, ~25
         35        MUL                                              ~27     !1, 3
         36        ADD                                              ~28     ~26, ~27
         37        IS_SMALLER                                               !4, ~28
         38      > JMPNZ                                                    ~29, ->13
   52    39    >   ASSIGN_OP                                    10          !3, 4294967232
   53    40      > RETURN                                                   !3
   54    41*       IS_SMALLER                                               !3, 0
         42*       JMPZ                                                     ~31, ->48
   55    43*       BW_AND                                           ~32     !3, 2147483584
         44*       SUB                                              ~33     2147483648, ~32
         45*       MUL                                              ~34     ~33, -1
         46*       RETURN                                                   ~34
         47*       JMP                                                      ->50
   57    48*       BW_AND                                           ~35     !3, 2147483584
         49*       RETURN                                                   ~35
   60    50*     > RETURN                                                   null

End of function getcharacterkey

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.33 ms | 1423 KiB | 26 Q