3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = 'test'; $resource = openssl_pkey_new(['private_key_bits' => 512]); $public_key = openssl_pkey_get_details($resource)['key']; openssl_pkey_export($resource, $private_key); openssl_public_encrypt($message, $enc_message, $public_key); $enc_message = base64_encode($enc_message); openssl_private_decrypt($enc_message, $dec_message, $private_key); $dec_message = base64_decode($dec_message); echo '<pre>'; var_dump([ 'public_key' => $public_key, 'private_key' => $private_key, 'message' => $message, 'enc_message' => $enc_message, 'dec_message' => $dec_message ]); echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jRri9
function name:  (null)
number of ops:  43
compiled vars:  !0 = $message, !1 = $resource, !2 = $public_key, !3 = $private_key, !4 = $enc_message, !5 = $dec_message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'test'
    4     1        INIT_FCALL_BY_NAME                                       'openssl_pkey_new'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $7      
          4        ASSIGN                                                   !1, $7
    5     5        INIT_FCALL_BY_NAME                                       'openssl_pkey_get_details'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $9      
          8        FETCH_DIM_R                                      ~10     $9, 'key'
          9        ASSIGN                                                   !2, ~10
    6    10        INIT_FCALL_BY_NAME                                       'openssl_pkey_export'
         11        SEND_VAR_EX                                              !1
         12        SEND_VAR_EX                                              !3
         13        DO_FCALL                                      0          
    8    14        INIT_FCALL_BY_NAME                                       'openssl_public_encrypt'
         15        SEND_VAR_EX                                              !0
         16        SEND_VAR_EX                                              !4
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0          
    9    19        INIT_FCALL                                               'base64_encode'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !4, $14
   11    23        INIT_FCALL_BY_NAME                                       'openssl_private_decrypt'
         24        SEND_VAR_EX                                              !4
         25        SEND_VAR_EX                                              !5
         26        SEND_VAR_EX                                              !3
         27        DO_FCALL                                      0          
   12    28        INIT_FCALL                                               'base64_decode'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                         $17     
         31        ASSIGN                                                   !5, $17
   15    32        ECHO                                                     '%3Cpre%3E'
   17    33        INIT_FCALL                                               'var_dump'
   18    34        INIT_ARRAY                                       ~19     !2, 'public_key'
   19    35        ADD_ARRAY_ELEMENT                                ~19     !3, 'private_key'
   20    36        ADD_ARRAY_ELEMENT                                ~19     !0, 'message'
   21    37        ADD_ARRAY_ELEMENT                                ~19     !4, 'enc_message'
   22    38        ADD_ARRAY_ELEMENT                                ~19     !5, 'dec_message'
         39        SEND_VAL                                                 ~19
         40        DO_ICALL                                                 
   25    41        ECHO                                                     '%3C%2Fpre%3E'
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.96 ms | 1400 KiB | 19 Q