3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sharedKey = hash('sha256','0-120913kassaaa'+floor(time() / 360),true); $encAlgo = MCRYPT_RIJNDAEL_256; $mcryptMode = MCRYPT_MODE_ECB; function encrypt_base64_urlenc($secret, $shared) { return urldecode(base64_decode(rtrim(mcrypt_decrypt( $encAlgo, $shared, $secret, $mcryptMode, mcrypt_create_iv( mcrypt_get_iv_size( $encAlgo, $mcryptMode ) ), MCRYPT_DEV_URANDOM ),'\0'))); } function decrypt_base64_urlenc($secret, $shared) { return rtrim(mcrypt_decrypt( $encAlgo, $shared, base64_decode(urldecode($secret)), $mcryptMode, mcrypt_create_iv( mcrypt_get_iv_size( $encAlgo, $mcryptMode ) ), MCRYPT_DEV_URANDOM ), '\0'); } $derp = encrypt_base64_urlenc("this is a secret"); $underp = decrypt_base64_urlenc($derp); echo $derp, "\n"; echo $underp, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a3Nv6
function name:  (null)
number of ops:  30
compiled vars:  !0 = $sharedKey, !1 = $encAlgo, !2 = $mcryptMode, !3 = $derp, !4 = $underp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'hash'
          1        SEND_VAL                                                 'sha256'
          2        INIT_FCALL                                               'floor'
          3        INIT_FCALL                                               'time'
          4        DO_ICALL                                         $5      
          5        DIV                                              ~6      $5, 360
          6        SEND_VAL                                                 ~6
          7        DO_ICALL                                         $7      
          8        ADD                                              ~8      '0-120913kassaaa', $7
          9        SEND_VAL                                                 ~8
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !0, $9
    4    13        FETCH_CONSTANT                                   ~11     'MCRYPT_RIJNDAEL_256'
         14        ASSIGN                                                   !1, ~11
    5    15        FETCH_CONSTANT                                   ~13     'MCRYPT_MODE_ECB'
         16        ASSIGN                                                   !2, ~13
   39    17        INIT_FCALL                                               'encrypt_base64_urlenc'
         18        SEND_VAL                                                 'this+is+a+secret'
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !3, $15
   40    21        INIT_FCALL                                               'decrypt_base64_urlenc'
         22        SEND_VAR                                                 !3
         23        DO_FCALL                                      0  $17     
         24        ASSIGN                                                   !4, $17
   42    25        ECHO                                                     !3
         26        ECHO                                                     '%0A'
   43    27        ECHO                                                     !4
         28        ECHO                                                     '%0A'
         29      > RETURN                                                   1

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

End of function encrypt_base64_urlenc

Function decrypt_base64_urlenc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a3Nv6
function name:  decrypt_base64_urlenc
number of ops:  30
compiled vars:  !0 = $secret, !1 = $shared, !2 = $encAlgo, !3 = $mcryptMode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        INIT_FCALL                                               'rtrim'
          3        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
   25     4        SEND_VAR_EX                                              !2
          5        SEND_VAR_EX                                              !1
   27     6        INIT_FCALL                                               'base64_decode'
          7        INIT_FCALL                                               'urldecode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        SEND_VAR_NO_REF_EX                                       $5
   25    13        SEND_VAR_EX                                              !3
   29    14        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
   30    15        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
   31    16        SEND_VAR_EX                                              !2
         17        SEND_VAR_EX                                              !3
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR_NO_REF_EX                                       $6
         20        DO_FCALL                                      0  $7      
         21        SEND_VAR_NO_REF_EX                                       $7
   35    22        FETCH_CONSTANT                                   ~8      'MCRYPT_DEV_URANDOM'
         23        SEND_VAL_EX                                              ~8
         24        DO_FCALL                                      0  $9      
         25        SEND_VAR                                                 $9
   36    26        SEND_VAL                                                 '%5C0'
         27        DO_ICALL                                         $10     
         28      > RETURN                                                   $10
   37    29*     > RETURN                                                   null

End of function decrypt_base64_urlenc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.1 ms | 1407 KiB | 27 Q