3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pass_crypt($password, $unique_salt) { return crypt($password, '$2a$10$'.$unique_salt); } function pass_salt() { return substr(sha1(mt_rand()),0,22); } function pass_encrypt($hash, $password) { $full_salt = substr($hash, 0, 29); $new_hash = crypt($password, $full_salt); // returns true or false return ($hash === $new_hash); } echo pass_crypt('e1d0b743ce230a5d3bfffa678848ecc8e79ad09d', pass_salt());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3kFg
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'pass_crypt'
          1        SEND_VAL                                                 'e1d0b743ce230a5d3bfffa678848ecc8e79ad09d'
          2        INIT_FCALL                                               'pass_salt'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0  $1      
          6        ECHO                                                     $1
          7      > RETURN                                                   1

Function pass_crypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3kFg
function name:  pass_crypt
number of ops:  9
compiled vars:  !0 = $password, !1 = $unique_salt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'crypt'
          3        SEND_VAR                                                 !0
          4        CONCAT                                           ~2      '%242a%2410%24', !1
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
    6     8*     > RETURN                                                   null

End of function pass_crypt

Function pass_salt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3kFg
function name:  pass_salt
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'substr'
          1        INIT_FCALL                                               'sha1'
          2        INIT_FCALL                                               'mt_rand'
          3        DO_ICALL                                         $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        SEND_VAL                                                 0
          8        SEND_VAL                                                 22
          9        DO_ICALL                                         $2      
         10      > RETURN                                                   $2
         11*     > RETURN                                                   null

End of function pass_salt

Function pass_encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3kFg
function name:  pass_encrypt
number of ops:  16
compiled vars:  !0 = $hash, !1 = $password, !2 = $full_salt, !3 = $new_hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 29
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !2, $4
   13     8        INIT_FCALL                                               'crypt'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !3, $6
   15    13        IS_IDENTICAL                                     ~8      !0, !3
         14      > RETURN                                                   ~8
   16    15*     > RETURN                                                   null

End of function pass_encrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.17 ms | 1403 KiB | 23 Q