3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Crypt { /** * Returns an encrypted & utf8-encoded */ public static function encrypt($pure_string, $encryption_key = 'poney') { $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, $encryption_key, $pure_string, MCRYPT_MODE_ECB, $iv); return $encrypted_string; } /** * Returns decrypted original string */ public static function decrypt($encrypted_string, $encryption_key = 'poney') { $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypted_string = mcrypt_decrypt(MCRYPT_BLOWFISH, $encryption_key, $encrypted_string, MCRYPT_MODE_ECB, $iv); return $decrypted_string; } } $hashParams = array( 'plopi' => 'gato', 'token' => 'lol' ); var_dump($hashParams); $hashParams = 46521; $strEncoded = Crypt::encrypt(json_encode($hashParams)); echo "\n encoded\t:" . json_encode($hashParams). "\n"; echo "\n encoded\t:" . $strEncoded. "\n"; echo "\n decode encoded\t:" . Crypt::decrypt($strEncoded)."\n"; var_dump(json_decode(Crypt::decrypt($strEncoded), true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ne8o
function name:  (null)
number of ops:  38
compiled vars:  !0 = $hashParams, !1 = $strEncoded
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                   !0, <array>
   34     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   36     4        ASSIGN                                                   !0, 46521
   39     5        INIT_STATIC_METHOD_CALL                                  'Crypt', 'encrypt'
          6        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !1, $6
   41    12        INIT_FCALL                                               'json_encode'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        CONCAT                                           ~9      '%0A+encoded%09%3A', $8
         16        CONCAT                                           ~10     ~9, '%0A'
         17        ECHO                                                     ~10
   42    18        CONCAT                                           ~11     '%0A+encoded%09%3A', !1
         19        CONCAT                                           ~12     ~11, '%0A'
         20        ECHO                                                     ~12
   43    21        INIT_STATIC_METHOD_CALL                                  'Crypt', 'decrypt'
         22        SEND_VAR                                                 !1
         23        DO_FCALL                                      0  $13     
         24        CONCAT                                           ~14     '%0A+decode+encoded%09%3A', $13
         25        CONCAT                                           ~15     ~14, '%0A'
         26        ECHO                                                     ~15
   45    27        INIT_FCALL                                               'var_dump'
         28        INIT_FCALL                                               'json_decode'
         29        INIT_STATIC_METHOD_CALL                                  'Crypt', 'decrypt'
         30        SEND_VAR                                                 !1
         31        DO_FCALL                                      0  $16     
         32        SEND_VAR                                                 $16
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $17     
         35        SEND_VAR                                                 $17
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Class Crypt:
Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ne8o
function name:  encrypt
number of ops:  27
compiled vars:  !0 = $pure_string, !1 = $encryption_key, !2 = $iv_size, !3 = $iv, !4 = $encrypted_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'poney'
   11     2        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
          3        FETCH_CONSTANT                                   ~5      'MCRYPT_BLOWFISH'
          4        SEND_VAL_EX                                              ~5
          5        FETCH_CONSTANT                                   ~6      'MCRYPT_MODE_ECB'
          6        SEND_VAL_EX                                              ~6
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   12     9        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~9      'MCRYPT_RAND'
         12        SEND_VAL_EX                                              ~9
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !3, $10
   13    15        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         16        FETCH_CONSTANT                                   ~12     'MCRYPT_BLOWFISH'
         17        SEND_VAL_EX                                              ~12
         18        SEND_VAR_EX                                              !1
         19        SEND_VAR_EX                                              !0
         20        FETCH_CONSTANT                                   ~13     'MCRYPT_MODE_ECB'
         21        SEND_VAL_EX                                              ~13
         22        SEND_VAR_EX                                              !3
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !4, $14
   14    25      > RETURN                                                   !4
   15    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/6ne8o
function name:  decrypt
number of ops:  27
compiled vars:  !0 = $encrypted_string, !1 = $encryption_key, !2 = $iv_size, !3 = $iv, !4 = $decrypted_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'poney'
   21     2        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
          3        FETCH_CONSTANT                                   ~5      'MCRYPT_BLOWFISH'
          4        SEND_VAL_EX                                              ~5
          5        FETCH_CONSTANT                                   ~6      'MCRYPT_MODE_ECB'
          6        SEND_VAL_EX                                              ~6
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   22     9        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~9      'MCRYPT_RAND'
         12        SEND_VAL_EX                                              ~9
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !3, $10
   23    15        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
         16        FETCH_CONSTANT                                   ~12     'MCRYPT_BLOWFISH'
         17        SEND_VAL_EX                                              ~12
         18        SEND_VAR_EX                                              !1
         19        SEND_VAR_EX                                              !0
         20        FETCH_CONSTANT                                   ~13     'MCRYPT_MODE_ECB'
         21        SEND_VAL_EX                                              ~13
         22        SEND_VAR_EX                                              !3
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !4, $14
   24    25      > RETURN                                                   !4
   25    26*     > RETURN                                                   null

End of function decrypt

End of class Crypt.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.28 ms | 1404 KiB | 19 Q