3v4l.org

run code in 300+ PHP versions simultaneously
<?php function apiEncode($data) { $td = mcrypt_module_open (MCRYPT_3DES, '', MCRYPT_MODE_ECB, ''); //Generate a key from a hash $key = "6702BC24DD0527E7"; //Create init vector //$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_ecb), MCRYPT_RAND); //Pad for PKCS7 $blockSize = mcrypt_get_block_size('tripledes', 'ecb'); $len = strlen($data); $pad = $blockSize - ($len % $blockSize); $data .= str_repeat(chr($pad), $pad); $key_add = 24-strlen($key); $key .= substr($key,0,$key_add); // append the first 8 bytes onto the end //Encrypt data //$encData = mcrypt_encrypt('tripledes', $key, $data, 'ecv');//, $iv); //return base64_encode($encData); //mcrypt_generic_init ($td, $key, $iv); $encrypt_text = mcrypt_generic ($td, $text); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $encrypt_text; } $crypt = apiEncode("00010"); echo "CRYPT: $crypt"; //$crypt2 = apiEncode("SimpleTripleDes"); // echo "CRYPT2: $crypt2";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fum1h
function name:  (null)
number of ops:  8
compiled vars:  !0 = $crypt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                               'apiencode'
          1        SEND_VAL                                                 '00010'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   62     4        NOP                                                      
          5        FAST_CONCAT                                      ~3      'CRYPT%3A+', !0
          6        ECHO                                                     ~3
   65     7      > RETURN                                                   1

Function apiencode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fum1h
function name:  apiEncode
number of ops:  51
compiled vars:  !0 = $data, !1 = $td, !2 = $key, !3 = $blockSize, !4 = $len, !5 = $pad, !6 = $key_add, !7 = $encrypt_text, !8 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL_BY_NAME                                       'mcrypt_module_open'
          2        FETCH_CONSTANT                                   ~9      'MCRYPT_3DES'
          3        SEND_VAL_EX                                              ~9
          4        SEND_VAL_EX                                              ''
          5        FETCH_CONSTANT                                   ~10     'MCRYPT_MODE_ECB'
          6        SEND_VAL_EX                                              ~10
          7        SEND_VAL_EX                                              ''
          8        DO_FCALL                                      0  $11     
          9        ASSIGN                                                   !1, $11
    9    10        ASSIGN                                                   !2, '6702BC24DD0527E7'
   14    11        INIT_FCALL_BY_NAME                                       'mcrypt_get_block_size'
         12        SEND_VAL_EX                                              'tripledes'
         13        SEND_VAL_EX                                              'ecb'
         14        DO_FCALL                                      0  $14     
         15        ASSIGN                                                   !3, $14
   15    16        STRLEN                                           ~16     !0
         17        ASSIGN                                                   !4, ~16
   16    18        MOD                                              ~18     !4, !3
         19        SUB                                              ~19     !3, ~18
         20        ASSIGN                                                   !5, ~19
   17    21        INIT_FCALL                                               'str_repeat'
         22        INIT_FCALL                                               'chr'
         23        SEND_VAR                                                 !5
         24        DO_ICALL                                         $21     
         25        SEND_VAR                                                 $21
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                         $22     
         28        ASSIGN_OP                                     8          !0, $22
   19    29        STRLEN                                           ~24     !2
         30        SUB                                              ~25     24, ~24
         31        ASSIGN                                                   !6, ~25
   20    32        INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !2
         34        SEND_VAL                                                 0
         35        SEND_VAR                                                 !6
         36        DO_ICALL                                         $27     
         37        ASSIGN_OP                                     8          !2, $27
   29    38        INIT_FCALL_BY_NAME                                       'mcrypt_generic'
         39        SEND_VAR_EX                                              !1
         40        SEND_VAR_EX                                              !8
         41        DO_FCALL                                      0  $29     
         42        ASSIGN                                                   !7, $29
   31    43        INIT_FCALL_BY_NAME                                       'mcrypt_generic_deinit'
         44        SEND_VAR_EX                                              !1
         45        DO_FCALL                                      0          
   33    46        INIT_FCALL_BY_NAME                                       'mcrypt_module_close'
         47        SEND_VAR_EX                                              !1
         48        DO_FCALL                                      0          
   35    49      > RETURN                                                   !7
   36    50*     > RETURN                                                   null

End of function apiencode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
225.97 ms | 1403 KiB | 20 Q