3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = '057e6752d585a7a94894dff65ab2537e'; $key = hash('sha256', $key, true); function encrypt($value) { $encryption_key = base64_decode($key); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); $encrypted = openssl_encrypt($value, 'aes-256-cbc', $encryption_key, 0, $iv); return base64_encode($encrypted . '::' . $iv); } function decrypt($value) { $encryption_key = base64_decode($key); list($encrypted_data, $iv) = explode('::', base64_decode($value), 2); return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv); } $criptando = encrypt('1038'); echo 'criptando : ' . $criptando . '<br>'; echo 'decriptando: ' . decrypt($criptando);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l3asq
function name:  (null)
number of ops:  20
compiled vars:  !0 = $key, !1 = $criptando
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '057e6752d585a7a94894dff65ab2537e'
    3     1        INIT_FCALL                                               'hash'
          2        SEND_VAL                                                 'sha256'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   18     7        INIT_FCALL                                               'encrypt'
          8        SEND_VAL                                                 '1038'
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !1, $5
   19    11        CONCAT                                           ~7      'criptando++%3A+', !1
         12        CONCAT                                           ~8      ~7, '%3Cbr%3E'
         13        ECHO                                                     ~8
   20    14        INIT_FCALL                                               'decrypt'
         15        SEND_VAR                                                 !1
         16        DO_FCALL                                      0  $9      
         17        CONCAT                                           ~10     'decriptando%3A+', $9
         18        ECHO                                                     ~10
         19      > RETURN                                                   1

Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l3asq
function name:  encrypt
number of ops:  27
compiled vars:  !0 = $value, !1 = $encryption_key, !2 = $key, !3 = $iv, !4 = $encrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'base64_decode'
          2        SEND_VAR                                                 !2
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    7     5        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
          6        INIT_FCALL_BY_NAME                                       'openssl_cipher_iv_length'
          7        SEND_VAL_EX                                              'aes-256-cbc'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR_NO_REF_EX                                       $7
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !3, $8
    8    12        INIT_FCALL_BY_NAME                                       'openssl_encrypt'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAL_EX                                              'aes-256-cbc'
         15        SEND_VAR_EX                                              !1
         16        SEND_VAL_EX                                              0
         17        SEND_VAR_EX                                              !3
         18        DO_FCALL                                      0  $10     
         19        ASSIGN                                                   !4, $10
    9    20        INIT_FCALL                                               'base64_encode'
         21        CONCAT                                           ~12     !4, '%3A%3A'
         22        CONCAT                                           ~13     ~12, !3
         23        SEND_VAL                                                 ~13
         24        DO_ICALL                                         $14     
         25      > RETURN                                                   $14
   10    26*     > RETURN                                                   null

End of function encrypt

Function decrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l3asq
function name:  decrypt
number of ops:  27
compiled vars:  !0 = $value, !1 = $encryption_key, !2 = $key, !3 = $encrypted_data, !4 = $iv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'base64_decode'
          2        SEND_VAR                                                 !2
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   14     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '%3A%3A'
          7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        SEND_VAR                                                 $7
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $8      
         13        FETCH_LIST_R                                     $9      $8, 0
         14        ASSIGN                                                   !3, $9
         15        FETCH_LIST_R                                     $11     $8, 1
         16        ASSIGN                                                   !4, $11
         17        FREE                                                     $8
   15    18        INIT_FCALL_BY_NAME                                       'openssl_decrypt'
         19        SEND_VAR_EX                                              !3
         20        SEND_VAL_EX                                              'aes-256-cbc'
         21        SEND_VAR_EX                                              !1
         22        SEND_VAL_EX                                              0
         23        SEND_VAR_EX                                              !4
         24        DO_FCALL                                      0  $13     
         25      > RETURN                                                   $13
   16    26*     > RETURN                                                   null

End of function decrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
280.36 ms | 1021 KiB | 19 Q