3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * crypt-test-salt-nul-bytes.php */ $saltLen = 16; $prefix = '$5$'; $length = 63; $plain = 'hello'; $salt = str_repeat("\0", $saltLen); $salt[15] = '.'; $salt[0] = '.'; $salt = ""; $result = crypt($plain, $prefix . $salt); var_dump($result); echo strlen($result) !== $length ? 'FAIL' : 'OK';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1pBsT
function name:  (null)
number of ops:  31
compiled vars:  !0 = $saltLen, !1 = $prefix, !2 = $length, !3 = $plain, !4 = $salt, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 16
    7     1        ASSIGN                                                   !1, '%245%24'
    8     2        ASSIGN                                                   !2, 63
    9     3        ASSIGN                                                   !3, 'hello'
   10     4        INIT_FCALL                                               'str_repeat'
          5        SEND_VAL                                                 '%00'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $10     
          8        ASSIGN                                                   !4, $10
   11     9        ASSIGN_DIM                                               !4, 15
         10        OP_DATA                                                  '.'
   12    11        ASSIGN_DIM                                               !4, 0
         12        OP_DATA                                                  '.'
   14    13        ASSIGN                                                   !4, ''
   16    14        INIT_FCALL                                               'crypt'
         15        SEND_VAR                                                 !3
         16        CONCAT                                           ~15     !1, !4
         17        SEND_VAL                                                 ~15
         18        DO_ICALL                                         $16     
         19        ASSIGN                                                   !5, $16
   18    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !5
         22        DO_ICALL                                                 
   19    23        STRLEN                                           ~19     !5
         24        IS_NOT_IDENTICAL                                         !2, ~19
         25      > JMPZ                                                     ~20, ->28
         26    >   QM_ASSIGN                                        ~21     'FAIL'
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~21     'OK'
         29    >   ECHO                                                     ~21
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.06 ms | 1401 KiB | 19 Q