3v4l.org

run code in 300+ PHP versions simultaneously
<?php $salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22); // 2a is the bcrypt algorithm selector, see http://php.net/crypt // 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt echo $hash = crypt('falcon', '$2a$12$' . $salt); echo "<br>"; echo '$2a$12$' . $salt; // we can now use the generated hash as the argument to crypt(), since it too will contain $a2$12$... with a variation of the hash. No need to store the salt anymore, just the hash is enough! var_dump($hash == crypt('foo', $hash)); // true var_dump($hash == crypt('falcon', $hash)); // false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aPo47
function name:  (null)
number of ops:  48
compiled vars:  !0 = $salt, !1 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'substr'
          1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%2B'
          3        SEND_VAL                                                 '.'
          4        INIT_FCALL                                               'base64_encode'
          5        INIT_FCALL                                               'sha1'
          6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                         $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                         $5      
         16        SEND_VAR                                                 $5
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 22
         19        DO_ICALL                                         $6      
         20        ASSIGN                                                   !0, $6
    7    21        INIT_FCALL                                               'crypt'
         22        SEND_VAL                                                 'falcon'
         23        CONCAT                                           ~8      '%242a%2412%24', !0
         24        SEND_VAL                                                 ~8
         25        DO_ICALL                                         $9      
         26        ASSIGN                                           ~10     !1, $9
         27        ECHO                                                     ~10
    8    28        ECHO                                                     '%3Cbr%3E'
    9    29        CONCAT                                           ~11     '%242a%2412%24', !0
         30        ECHO                                                     ~11
   12    31        INIT_FCALL                                               'var_dump'
         32        INIT_FCALL                                               'crypt'
         33        SEND_VAL                                                 'foo'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                         $12     
         36        IS_EQUAL                                         ~13     !1, $12
         37        SEND_VAL                                                 ~13
         38        DO_ICALL                                                 
   13    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL                                               'crypt'
         41        SEND_VAL                                                 'falcon'
         42        SEND_VAR                                                 !1
         43        DO_ICALL                                         $15     
         44        IS_EQUAL                                         ~16     !1, $15
         45        SEND_VAL                                                 ~16
         46        DO_ICALL                                                 
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.62 ms | 1400 KiB | 27 Q