3v4l.org

run code in 500+ PHP versions simultaneously
<?php class DES{ public static function encrypt($str,$key){ $str = self::pkcs5_pad($str, 8); if (strlen($str) % 8) { $str = str_pad($str, strlen($str) + 8 - strlen($str) % 8, "\0"); } $sign = openssl_encrypt ( $str, 'DES-EDE3' , $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING , '' ); return strtoupper(bin2hex($sign)); } private static function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } } $res = DES::encrypt('test', 'aaaabbbb'); var_dump($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idvec
function name:  (null)
number of ops:  9
compiled vars:  !0 = $res
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                      'DES', 'encrypt'
          1        SEND_VAL                                                     'test'
          2        SEND_VAL                                                     'aaaabbbb'
          3        DO_FCALL                                          0  $1      
          4        ASSIGN                                                       !0, $1
   28     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Class DES:
Function encrypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/idvec
function name:  encrypt
number of ops:  40
compiled vars:  !0 = $str, !1 = $key, !2 = $sign
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        INIT_STATIC_METHOD_CALL                                      'pkcs5_pad'
          3        SEND_VAR_EX                                                  !0
          4        SEND_VAL_EX                                                  8
          5        DO_FCALL                                          0  $3      
          6        ASSIGN                                                       !0, $3
    6     7        STRLEN                                               ~5      !0
          8        MOD                                                  ~6      ~5, 8
          9      > JMPZ                                                         ~6, ->21
    7    10    >   INIT_FCALL                                                   'str_pad'
         11        SEND_VAR                                                     !0
    8    12        STRLEN                                               ~7      !0
         13        ADD                                                  ~8      ~7, 8
         14        STRLEN                                               ~9      !0
         15        MOD                                                  ~10     ~9, 8
         16        SUB                                                  ~11     ~8, ~10
         17        SEND_VAL                                                     ~11
         18        SEND_VAL                                                     '%00'
    7    19        DO_ICALL                                             $12     
         20        ASSIGN                                                       !0, $12
   10    21    >   INIT_FCALL_BY_NAME                                           'openssl_encrypt'
   11    22        SEND_VAR_EX                                                  !0
   12    23        SEND_VAL_EX                                                  'DES-EDE3'
   11    24        SEND_VAR_EX                                                  !1
   14    25        FETCH_CONSTANT                                       ~14     'OPENSSL_RAW_DATA'
         26        FETCH_CONSTANT                                       ~15     'OPENSSL_NO_PADDING'
         27        BW_OR                                                ~16     ~14, ~15
         28        SEND_VAL_EX                                                  ~16
   15    29        SEND_VAL_EX                                                  ''
   10    30        DO_FCALL                                          0  $17     
         31        ASSIGN                                                       !2, $17
   18    32        INIT_FCALL                                                   'strtoupper'
         33        INIT_FCALL                                                   'bin2hex'
         34        SEND_VAR                                                     !2
         35        DO_ICALL                                             $19     
         36        SEND_VAR                                                     $19
         37        DO_ICALL                                             $20     
         38      > RETURN                                                       $20
   19    39*     > RETURN                                                       null

End of function encrypt

Function pkcs5_pad:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idvec
function name:  pkcs5_pad
number of ops:  16
compiled vars:  !0 = $text, !1 = $blocksize, !2 = $pad
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   22     2        STRLEN                                               ~3      !0
          3        MOD                                                  ~4      ~3, !1
          4        SUB                                                  ~5      !1, ~4
          5        ASSIGN                                                       !2, ~5
   23     6        INIT_FCALL                                                   'str_repeat'
          7        INIT_FCALL                                                   'chr'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                             $7      
         10        SEND_VAR                                                     $7
         11        SEND_VAR                                                     !2
         12        DO_ICALL                                             $8      
         13        CONCAT                                               ~9      !0, $8
         14      > RETURN                                                       ~9
   24    15*     > RETURN                                                       null

End of function pkcs5_pad

End of class DES.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.76 ms | 2621 KiB | 19 Q