3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sSecretKey = 'TrueID2015tRUEid'; $json = json_encode([ "trueid" => "0864073341", "ssoid" => "19041211", "access_token" => "171|1.c31e0e8fe71d8215f1ff95__3600.1442364865- 19041211|7c938d42413cbdcf23500388375", "thaiid" => "5101599032198", "channel" => "trueid", "paytype" => "credit", "total" => "1010.87", "lang" => "th", "payment" => [ "count" => "2", "invoicelist" => [ [ "invoice_number" => "0001392172791881", "invoice_amount" => "320.47", "amount" => "320.47", "company_code" => "RM", "service_number" => "0864073341", "ban_number" => "16652487", "due_date" => "18/10/2015", "bill_month" => "102015" ], [ "invoice_number" => "000139217279xxxx", "invoice_amount" => "660.93", "amount" => "660.93", "company_code" => "AC", "service_number" => "NF0095630I", "ban_number" => "150024746305", "due_date" => "20/10/2015", "bill_month" => "102015" ] ] ] ]); $encrypt = fnEncrypt($json, $sSecretKey); function fnEncrypt($sValue, $sSecretKey) { $iv = base64_decode('Jc8EZ9nZPbWZEoV4ad8/CQ=='); $sValue = pkcs5_pad($sValue, mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $sValue = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $sSecretKey, $sValue, MCRYPT_MODE_CBC, $iv); $sValue = base64_encode($sValue); return $sValue; } function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); $pad2 = $text . str_repeat(chr($pad), $pad); return $pad2; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9XYUt
function name:  (null)
number of ops:  11
compiled vars:  !0 = $sSecretKey, !1 = $json, !2 = $encrypt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'TrueID2015tRUEid'
    3     1        INIT_FCALL                                               'json_encode'
    4     2        SEND_VAL                                                 <array>
          3        DO_ICALL                                         $4      
    3     4        ASSIGN                                                   !1, $4
   38     5        INIT_FCALL_BY_NAME                                       'fnEncrypt'
          6        SEND_VAR_EX                                              !1
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !2, $6
   48    10      > RETURN                                                   1

Function fnencrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9XYUt
function name:  fnEncrypt
number of ops:  33
compiled vars:  !0 = $sValue, !1 = $sSecretKey, !2 = $iv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   41     2        INIT_FCALL                                               'base64_decode'
          3        SEND_VAL                                                 'Jc8EZ9nZPbWZEoV4ad8%2FCQ%3D%3D'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
   42     6        INIT_FCALL_BY_NAME                                       'pkcs5_pad'
          7        SEND_VAR_EX                                              !0
          8        INIT_FCALL_BY_NAME                                       'mcrypt_get_block_size'
          9        FETCH_CONSTANT                                   ~5      'MCRYPT_RIJNDAEL_128'
         10        SEND_VAL_EX                                              ~5
         11        FETCH_CONSTANT                                   ~6      'MCRYPT_MODE_CBC'
         12        SEND_VAL_EX                                              ~6
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR_NO_REF_EX                                       $7
         15        DO_FCALL                                      0  $8      
         16        ASSIGN                                                   !0, $8
   43    17        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         18        FETCH_CONSTANT                                   ~10     'MCRYPT_RIJNDAEL_128'
         19        SEND_VAL_EX                                              ~10
         20        SEND_VAR_EX                                              !1
         21        SEND_VAR_EX                                              !0
         22        FETCH_CONSTANT                                   ~11     'MCRYPT_MODE_CBC'
         23        SEND_VAL_EX                                              ~11
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0  $12     
         26        ASSIGN                                                   !0, $12
   44    27        INIT_FCALL                                               'base64_encode'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $14     
         30        ASSIGN                                                   !0, $14
   45    31      > RETURN                                                   !0
         32*     > RETURN                                                   null

End of function fnencrypt

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

End of function pkcs5_pad

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.59 ms | 1400 KiB | 23 Q