3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = array( "digest_alg" => "sha1", "private_key_bits" => 1024, "private_key_type" => OPENSSL_KEYTYPE_RSA, ); // Create the private and public key $res = openssl_pkey_new($config); // Create the keypair //$res=openssl_pkey_new(); // Get private key openssl_pkey_export($res, $privatekey); $privatekey=base64_encode($privatekey); // Get public key $publickey=openssl_pkey_get_details($res); $publickey=base64_encode($publickey["key"]); echo "Private Key:<BR>$privatekey<br><br>Public Key:<BR>$publickey<BR><BR>"; $string = 'It works ? Or not it works ?'; $method = 'aes128'; file_put_contents ('./file.encrypted', openssl_encrypt ($string, $method, $pass));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WPulY
function name:  (null)
number of ops:  44
compiled vars:  !0 = $config, !1 = $res, !2 = $privatekey, !3 = $publickey, !4 = $string, !5 = $method, !6 = $pass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_ARRAY                                       ~7      'sha1', 'digest_alg'
    4     1        ADD_ARRAY_ELEMENT                                ~7      1024, 'private_key_bits'
    5     2        FETCH_CONSTANT                                   ~8      'OPENSSL_KEYTYPE_RSA'
          3        ADD_ARRAY_ELEMENT                                ~7      ~8, 'private_key_type'
    2     4        ASSIGN                                                   !0, ~7
    9     5        INIT_FCALL_BY_NAME                                       'openssl_pkey_new'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $10     
          8        ASSIGN                                                   !1, $10
   16     9        INIT_FCALL_BY_NAME                                       'openssl_pkey_export'
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0          
   17    13        INIT_FCALL                                               'base64_encode'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !2, $13
   19    17        INIT_FCALL_BY_NAME                                       'openssl_pkey_get_details'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !3, $15
   20    21        INIT_FCALL                                               'base64_encode'
         22        FETCH_DIM_R                                      ~17     !3, 'key'
         23        SEND_VAL                                                 ~17
         24        DO_ICALL                                         $18     
         25        ASSIGN                                                   !3, $18
   22    26        ROPE_INIT                                     5  ~21     'Private+Key%3A%3CBR%3E'
         27        ROPE_ADD                                      1  ~21     ~21, !2
         28        ROPE_ADD                                      2  ~21     ~21, '%3Cbr%3E%3Cbr%3EPublic+Key%3A%3CBR%3E'
         29        ROPE_ADD                                      3  ~21     ~21, !3
         30        ROPE_END                                      4  ~20     ~21, '%3CBR%3E%3CBR%3E'
         31        ECHO                                                     ~20
   24    32        ASSIGN                                                   !4, 'It+works+%3F+Or+not+it+works+%3F'
   26    33        ASSIGN                                                   !5, 'aes128'
   28    34        INIT_FCALL                                               'file_put_contents'
         35        SEND_VAL                                                 '.%2Ffile.encrypted'
         36        INIT_FCALL_BY_NAME                                       'openssl_encrypt'
         37        SEND_VAR_EX                                              !4
         38        SEND_VAR_EX                                              !5
         39        SEND_VAR_EX                                              !6
         40        DO_FCALL                                      0  $26     
         41        SEND_VAR                                                 $26
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.75 ms | 1400 KiB | 17 Q