3v4l.org

run code in 300+ PHP versions simultaneously
<?php function simple_encrypt($text, $salt = "earlysandwich.com") { return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); } // This function will be used to decrypt data. function simple_decrypt($text, $salt = "earlysandwich.com") { return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))); } // Encrypt a tring and echo it $encoded = simple_encrypt("this text will be encoded and decoded" , "secured"); echo "This is encoded string: $encoded \n"; // Now to decode the encoded text $decoded = simple_decrypt($encoded , "secured"); echo "This is decoded string: $decoded \n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jVHrO
function name:  (null)
number of ops:  19
compiled vars:  !0 = $encoded, !1 = $decoded
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'simple_encrypt'
          1        SEND_VAL                                                 'this+text+will+be+encoded+and+decoded'
          2        SEND_VAL                                                 'secured'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   15     5        ROPE_INIT                                     3  ~5      'This+is+encoded+string%3A+'
          6        ROPE_ADD                                      1  ~5      ~5, !0
          7        ROPE_END                                      2  ~4      ~5, '+%0A'
          8        ECHO                                                     ~4
   18     9        INIT_FCALL                                               'simple_decrypt'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'secured'
         12        DO_FCALL                                      0  $7      
         13        ASSIGN                                                   !1, $7
   19    14        ROPE_INIT                                     3  ~10     'This+is+decoded+string%3A+'
         15        ROPE_ADD                                      1  ~10     ~10, !1
         16        ROPE_END                                      2  ~9      ~10, '+%0A'
         17        ECHO                                                     ~9
         18      > RETURN                                                   1

Function simple_encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jVHrO
function name:  simple_encrypt
number of ops:  30
compiled vars:  !0 = $text, !1 = $salt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'earlysandwich.com'
    5     2        INIT_FCALL                                               'trim'
          3        INIT_FCALL                                               'base64_encode'
          4        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
          5        FETCH_CONSTANT                                   ~2      'MCRYPT_RIJNDAEL_256'
          6        SEND_VAL_EX                                              ~2
          7        SEND_VAR_EX                                              !1
          8        SEND_VAR_EX                                              !0
          9        FETCH_CONSTANT                                   ~3      'MCRYPT_MODE_ECB'
         10        SEND_VAL_EX                                              ~3
         11        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         12        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
         13        FETCH_CONSTANT                                   ~4      'MCRYPT_RIJNDAEL_256'
         14        SEND_VAL_EX                                              ~4
         15        FETCH_CONSTANT                                   ~5      'MCRYPT_MODE_ECB'
         16        SEND_VAL_EX                                              ~5
         17        DO_FCALL                                      0  $6      
         18        SEND_VAR_NO_REF_EX                                       $6
         19        FETCH_CONSTANT                                   ~7      'MCRYPT_RAND'
         20        SEND_VAL_EX                                              ~7
         21        DO_FCALL                                      0  $8      
         22        SEND_VAR_NO_REF_EX                                       $8
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                         $10     
         26        SEND_VAR                                                 $10
         27        DO_ICALL                                         $11     
         28      > RETURN                                                   $11
    6    29*     > RETURN                                                   null

End of function simple_encrypt

Function simple_decrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jVHrO
function name:  simple_decrypt
number of ops:  30
compiled vars:  !0 = $text, !1 = $salt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'earlysandwich.com'
   10     2        INIT_FCALL                                               'trim'
          3        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
          4        FETCH_CONSTANT                                   ~2      'MCRYPT_RIJNDAEL_256'
          5        SEND_VAL_EX                                              ~2
          6        SEND_VAR_EX                                              !1
          7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        FETCH_CONSTANT                                   ~4      'MCRYPT_MODE_ECB'
         12        SEND_VAL_EX                                              ~4
         13        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         14        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
         15        FETCH_CONSTANT                                   ~5      'MCRYPT_RIJNDAEL_256'
         16        SEND_VAL_EX                                              ~5
         17        FETCH_CONSTANT                                   ~6      'MCRYPT_MODE_ECB'
         18        SEND_VAL_EX                                              ~6
         19        DO_FCALL                                      0  $7      
         20        SEND_VAR_NO_REF_EX                                       $7
         21        FETCH_CONSTANT                                   ~8      'MCRYPT_RAND'
         22        SEND_VAL_EX                                              ~8
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR_NO_REF_EX                                       $9
         25        DO_FCALL                                      0  $10     
         26        SEND_VAR                                                 $10
         27        DO_ICALL                                         $11     
         28      > RETURN                                                   $11
   11    29*     > RETURN                                                   null

End of function simple_decrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.77 ms | 948 KiB | 22 Q