3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * It should go without saying that this is insecure. * * Don't use it! * * @ref http://www.cryptofails.com/post/87697461507/46esab-high-quality-cryptography-direct-from */ function encodeString($str){ for($i=0; $i<5;$i++) { $str=strrev(base64_encode($str)); // apply base64 first and then reverse the string } return $str; } function decodeString($str){ for($i=0; $i<5;$i++) { $str=base64_decode(strrev($str)); // apply base64 first and then reverse the string } return $str; } # ~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~ # $a = array( 'a', 'aaa', 'aaaaaa', str_repeat('a', 126), str_repeat('a', 1024), str_repeat('a', 2048) ); $sizeOfA = count($a); $length = array(); $encoded = array(); for ($i = 0; $i < $sizeOfA; ++$i) { $encoded[$i] = encodeString($a[$i]); $length[$i] = strlen($encoded[$i]); } var_dump($length); var_dump($encoded);

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 25
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 25
Branch analysis from position: 38
Branch analysis from position: 25
filename:       /in/BZ7rC
function name:  (null)
number of ops:  45
compiled vars:  !0 = $a, !1 = $sizeOfA, !2 = $length, !3 = $encoded, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_ARRAY                                       ~5      'a'
   30     1        ADD_ARRAY_ELEMENT                                ~5      'aaa'
   31     2        ADD_ARRAY_ELEMENT                                ~5      'aaaaaa'
   32     3        INIT_FCALL                                               'str_repeat'
          4        SEND_VAL                                                 'a'
          5        SEND_VAL                                                 126
          6        DO_ICALL                                         $6      
          7        ADD_ARRAY_ELEMENT                                ~5      $6
   33     8        INIT_FCALL                                               'str_repeat'
          9        SEND_VAL                                                 'a'
         10        SEND_VAL                                                 1024
         11        DO_ICALL                                         $7      
         12        ADD_ARRAY_ELEMENT                                ~5      $7
   34    13        INIT_FCALL                                               'str_repeat'
         14        SEND_VAL                                                 'a'
         15        SEND_VAL                                                 2048
         16        DO_ICALL                                         $8      
         17        ADD_ARRAY_ELEMENT                                ~5      $8
   28    18        ASSIGN                                                   !0, ~5
   36    19        COUNT                                            ~10     !0
         20        ASSIGN                                                   !1, ~10
   37    21        ASSIGN                                                   !2, <array>
   38    22        ASSIGN                                                   !3, <array>
   39    23        ASSIGN                                                   !4, 0
         24      > JMP                                                      ->36
   40    25    >   INIT_FCALL                                               'encodestring'
         26        FETCH_DIM_R                                      ~16     !0, !4
         27        SEND_VAL                                                 ~16
         28        DO_FCALL                                      0  $17     
         29        ASSIGN_DIM                                               !3, !4
         30        OP_DATA                                                  $17
   41    31        FETCH_DIM_R                                      ~19     !3, !4
         32        STRLEN                                           ~20     ~19
         33        ASSIGN_DIM                                               !2, !4
         34        OP_DATA                                                  ~20
   39    35        PRE_INC                                                  !4
         36    >   IS_SMALLER                                               !4, !1
         37      > JMPNZ                                                    ~22, ->25
   43    38    >   INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                                 
   44    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !3
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Function encodestring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/BZ7rC
function name:  encodeString
number of ops:  15
compiled vars:  !0 = $str, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
   13     3    >   INIT_FCALL                                               'strrev'
          4        INIT_FCALL                                               'base64_encode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
   11    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 5
         12      > JMPNZ                                                    ~7, ->3
   15    13    > > RETURN                                                   !0
   16    14*     > RETURN                                                   null

End of function encodestring

Function decodestring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/BZ7rC
function name:  decodeString
number of ops:  15
compiled vars:  !0 = $str, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
   21     3    >   INIT_FCALL                                               'base64_decode'
          4        INIT_FCALL                                               'strrev'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
   19    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 5
         12      > JMPNZ                                                    ~7, ->3
   23    13    > > RETURN                                                   !0
   24    14*     > RETURN                                                   null

End of function decodestring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.32 ms | 1452 KiB | 19 Q