3v4l.org

run code in 300+ PHP versions simultaneously
<?php const CIPHER = MCRYPT_RIJNDAEL_128; const KEY_BYTE_SIZE = 16; const CIPHER_MODE = 'cbc'; const HASH_FUNCTION = 'sha256'; const MAC_BYTE_SIZE = 32; const ENCRYPTION_INFO = 'PIPS|KeyForEncryption'; const AUTHENTICATION_INFO = 'PIPS|KeyForAuthentication'; $key = base64_decode('wdmd3XIhnOAelom4Y8yPbw=='); $result = Encrypt('asdfasdfasdfasdf', $key); print urlsafe_b64encode($result) + "\n\n"; $ekey = HKDF(HASH_FUNCTION, $key, KEY_BYTE_SIZE, ENCRYPTION_INFO); //print "$ekey\n"; //print urlsafe_b64encode($ekey) . "\n"; //$ivsize = mcrypt_get_iv_size(CIPHER, CIPHER_MODE); //if ($ivsize === FALSE || $ivsize <= 0) { // throw new CannotPerformOperationException(); //} $ivsize= 16; $iv = SecureRandom($ivsize); //print urlsafe_b64encode($iv) . "\n"; $raw = PlainEncrypt('asdfasdfasdfasdf', $ekey, $iv); //print $raw . "\n"; //print urlsafe_b64encode($raw); function urlsafe_b64encode($string) { $data = base64_encode($string); $data = str_replace(array('+','/','='),array('-','_',''),$data); return $data; } function urlsafe_b64decode($string) { $data = str_replace(array('-','_'),array('+','/'),$string); return base64_decode($data); } function HKDF($hash, $ikm, $length, $info = '', $salt = NULL) { // Find the correct digest length as quickly as we can. $digest_length = MAC_BYTE_SIZE; if ($hash != HASH_FUNCTION) { $digest_length = strlen(hash_hmac($hash, '', '', true)); } // Sanity-check the desired output length. if (empty($length) || !is_int($length) || $length < 0 || $length > 255 * $digest_length) { return CannotPerformOperationException(); } // "if [salt] not provided, is set to a string of HashLen zeroes." if (is_null($salt)) { $salt = str_repeat("\x00", $digest_length); } // HKDF-Extract: // PRK = HMAC-Hash(salt, IKM) // The salt is the HMAC key. $prk = hash_hmac($hash, $ikm, $salt, true); // HKDF-Expand: // This check is useless, but it serves as a reminder to the spec. if (strlen($prk) < $digest_length) { throw new CannotPerformOperationException(); } // T(0) = '' $t = ''; $last_block = ''; for ($block_index = 1; strlen($t) < $length; $block_index++) { // T(i) = HMAC-Hash(PRK, T(i-1) | info | 0x??) $last_block = hash_hmac( $hash, $last_block . $info . chr($block_index), $prk, true ); // T = T(1) | T(2) | T(3) | ... | T(N) $t .= $last_block; } // ORM = first L octets of T $orm = substr($t, 0, $length); if ($orm === FALSE) { throw new CannotPerformOperationException(); } return $orm; } function SecureRandom($octets) { return urlsafe_b64decode('FSDTs5UoRN07CAeB84KVIw'); $random = mcrypt_create_iv($octets, MCRYPT_DEV_URANDOM); if ($random === FALSE) { throw new CannotPerformOperationException(); } else { return $random; } } function PlainEncrypt($plaintext, $key, $iv) { $crypt = mcrypt_module_open(CIPHER, "", CIPHER_MODE, ""); if ($crypt === FALSE) { throw new CannotPerformOperationException(); } // Pad the plaintext to a multiple of the block size. $block = mcrypt_enc_get_block_size($crypt); $pad = $block - (strlen($plaintext) % $block); $plaintext .= str_repeat(chr($pad), $pad); $ret = mcrypt_generic_init($crypt, $key, $iv); if ($ret !== 0) { throw new CannotPerformOperationException(); } $ciphertext = mcrypt_generic($crypt, $plaintext); $ret = mcrypt_generic_deinit($crypt); if ($ret !== TRUE) { throw new CannotPerformOperationException(); } $ret = mcrypt_module_close($crypt); if ($ret !== TRUE) { throw new CannotPerformOperationException(); } return $ciphertext; } function Encrypt($plaintext, $key) { if (strlen($key) !== KEY_BYTE_SIZE) { throw new CannotPerformOperationException("Bad key."); } // Generate a sub-key for encryption. $keysize = KEY_BYTE_SIZE; $ekey = HKDF(HASH_FUNCTION, $key, $keysize, ENCRYPTION_INFO); // Generate a random initialization vector. $ivsize = mcrypt_get_iv_size(CIPHER, CIPHER_MODE); if ($ivsize === FALSE || $ivsize <= 0) { throw new CannotPerformOperationException(); } $iv = SecureRandom($ivsize); $ciphertext = $iv . PlainEncrypt($plaintext, $ekey, $iv); // Generate a sub-key for authentication and apply the HMAC. $akey = HKDF(HASH_FUNCTION, $key, KEY_BYTE_SIZE, AUTHENTICATION_INFO); $auth = hash_hmac(HASH_FUNCTION, $ciphertext, $akey, true); $ciphertext = $auth . $ciphertext; return $ciphertext; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkhqO
function name:  (null)
number of ops:  43
compiled vars:  !0 = $key, !1 = $result, !2 = $ekey, !3 = $ivsize, !4 = $iv, !5 = $raw
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'CIPHER', <const ast>
    4     1        DECLARE_CONST                                            'KEY_BYTE_SIZE', 16
    5     2        DECLARE_CONST                                            'CIPHER_MODE', 'cbc'
    6     3        DECLARE_CONST                                            'HASH_FUNCTION', 'sha256'
    7     4        DECLARE_CONST                                            'MAC_BYTE_SIZE', 32
    8     5        DECLARE_CONST                                            'ENCRYPTION_INFO', 'PIPS%7CKeyForEncryption'
    9     6        DECLARE_CONST                                            'AUTHENTICATION_INFO', 'PIPS%7CKeyForAuthentication'
   11     7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAL                                                 'wdmd3XIhnOAelom4Y8yPbw%3D%3D'
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !0, $6
   13    11        INIT_FCALL_BY_NAME                                       'Encrypt'
         12        SEND_VAL_EX                                              'asdfasdfasdfasdf'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $8      
         15        ASSIGN                                                   !1, $8
   14    16        INIT_FCALL_BY_NAME                                       'urlsafe_b64encode'
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0  $10     
         19        ADD                                              ~11     $10, '%0A%0A'
         20        ECHO                                                     ~11
   16    21        INIT_FCALL_BY_NAME                                       'HKDF'
         22        FETCH_CONSTANT                                   ~12     'HASH_FUNCTION'
         23        SEND_VAL_EX                                              ~12
         24        SEND_VAR_EX                                              !0
         25        FETCH_CONSTANT                                   ~13     'KEY_BYTE_SIZE'
         26        SEND_VAL_EX                                              ~13
         27        FETCH_CONSTANT                                   ~14     'ENCRYPTION_INFO'
         28        SEND_VAL_EX                                              ~14
         29        DO_FCALL                                      0  $15     
         30        ASSIGN                                                   !2, $15
   24    31        ASSIGN                                                   !3, 16
   25    32        INIT_FCALL_BY_NAME                                       'SecureRandom'
         33        SEND_VAR_EX                                              !3
         34        DO_FCALL                                      0  $18     
         35        ASSIGN                                                   !4, $18
   27    36        INIT_FCALL_BY_NAME                                       'PlainEncrypt'
         37        SEND_VAL_EX                                              'asdfasdfasdfasdf'
         38        SEND_VAR_EX                                              !2
         39        SEND_VAR_EX                                              !4
         40        DO_FCALL                                      0  $20     
         41        ASSIGN                                                   !5, $20
  167    42      > RETURN                                                   1

Function urlsafe_b64encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkhqO
function name:  urlsafe_b64encode
number of ops:  13
compiled vars:  !0 = $string, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   32     1        INIT_FCALL                                               'base64_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   33     5        INIT_FCALL                                               'str_replace'
          6        SEND_VAL                                                 <array>
          7        SEND_VAL                                                 <array>
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $4      
         10        ASSIGN                                                   !1, $4
   34    11      > RETURN                                                   !1
   35    12*     > RETURN                                                   null

End of function urlsafe_b64encode

Function urlsafe_b64decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkhqO
function name:  urlsafe_b64decode
number of ops:  12
compiled vars:  !0 = $string, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   38     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 <array>
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
   39     7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   40    11*     > RETURN                                                   null

End of function urlsafe_b64decode

Function hkdf:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 54
Branch analysis from position: 51
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 58
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 86
Branch analysis from position: 83
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 58
Branch analysis from position: 75
Branch analysis from position: 58
Branch analysis from position: 41
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 18
filename:       /in/WkhqO
function name:  HKDF
number of ops:  88
compiled vars:  !0 = $hash, !1 = $ikm, !2 = $length, !3 = $info, !4 = $salt, !5 = $digest_length, !6 = $prk, !7 = $t, !8 = $last_block, !9 = $block_index, !10 = $orm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      ''
          4        RECV_INIT                                        !4      null
   45     5        FETCH_CONSTANT                                   ~11     'MAC_BYTE_SIZE'
          6        ASSIGN                                                   !5, ~11
   46     7        FETCH_CONSTANT                                   ~13     'HASH_FUNCTION'
          8        IS_NOT_EQUAL                                             !0, ~13
          9      > JMPZ                                                     ~14, ->18
   47    10    >   INIT_FCALL                                               'hash_hmac'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 ''
         13        SEND_VAL                                                 ''
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $15     
         16        STRLEN                                           ~16     $15
         17        ASSIGN                                                   !5, ~16
   51    18    >   ISSET_ISEMPTY_CV                                 ~18     !2
         19      > JMPNZ_EX                                         ~18     ~18, ->23
         20    >   TYPE_CHECK                                   16  ~19     !2
         21        BOOL_NOT                                         ~20     ~19
         22        BOOL                                             ~18     ~20
         23    > > JMPNZ_EX                                         ~18     ~18, ->26
   52    24    >   IS_SMALLER                                       ~21     !2, 0
         25        BOOL                                             ~18     ~21
         26    > > JMPNZ_EX                                         ~18     ~18, ->30
         27    >   MUL                                              ~22     !5, 255
         28        IS_SMALLER                                       ~23     ~22, !2
         29        BOOL                                             ~18     ~23
         30    > > JMPZ                                                     ~18, ->34
   53    31    >   INIT_FCALL_BY_NAME                                       'CannotPerformOperationException'
         32        DO_FCALL                                      0  $24     
         33      > RETURN                                                   $24
   57    34    >   TYPE_CHECK                                    2          !4
         35      > JMPZ                                                     ~25, ->41
   58    36    >   INIT_FCALL                                               'str_repeat'
         37        SEND_VAL                                                 '%00'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                         $26     
         40        ASSIGN                                                   !4, $26
   64    41    >   INIT_FCALL                                               'hash_hmac'
         42        SEND_VAR                                                 !0
         43        SEND_VAR                                                 !1
         44        SEND_VAR                                                 !4
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $28     
         47        ASSIGN                                                   !6, $28
   69    48        STRLEN                                           ~30     !6
         49        IS_SMALLER                                               ~30, !5
         50      > JMPZ                                                     ~31, ->54
   70    51    >   NEW                                              $32     'CannotPerformOperationException'
         52        DO_FCALL                                      0          
         53      > THROW                                         0          $32
   74    54    >   ASSIGN                                                   !7, ''
   75    55        ASSIGN                                                   !8, ''
   76    56        ASSIGN                                                   !9, 1
         57      > JMP                                                      ->72
   78    58    >   INIT_FCALL                                               'hash_hmac'
   79    59        SEND_VAR                                                 !0
   80    60        CONCAT                                           ~37     !8, !3
         61        INIT_FCALL                                               'chr'
         62        SEND_VAR                                                 !9
         63        DO_ICALL                                         $38     
         64        CONCAT                                           ~39     ~37, $38
         65        SEND_VAL                                                 ~39
   81    66        SEND_VAR                                                 !6
   82    67        SEND_VAL                                                 <true>
         68        DO_ICALL                                         $40     
   78    69        ASSIGN                                                   !8, $40
   85    70        ASSIGN_OP                                     8          !7, !8
   76    71        PRE_INC                                                  !9
         72    >   STRLEN                                           ~44     !7
         73        IS_SMALLER                                               ~44, !2
         74      > JMPNZ                                                    ~45, ->58
   89    75    >   INIT_FCALL                                               'substr'
         76        SEND_VAR                                                 !7
         77        SEND_VAL                                                 0
         78        SEND_VAR                                                 !2
         79        DO_ICALL                                         $46     
         80        ASSIGN                                                   !10, $46
   90    81        TYPE_CHECK                                    4          !10
         82      > JMPZ                                                     ~48, ->86
   91    83    >   NEW                                              $49     'CannotPerformOperationException'
         84        DO_FCALL                                      0          
         85      > THROW                                         0          $49
   93    86    > > RETURN                                                   !10
   94    87*     > RETURN                                                   null

End of function hkdf

Function securerandom:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkhqO
function name:  SecureRandom
number of ops:  19
compiled vars:  !0 = $octets, !1 = $random
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   RECV                                             !0      
   98     1        INIT_FCALL                                               'urlsafe_b64decode'
          2        SEND_VAL                                                 'FSDTs5UoRN07CAeB84KVIw'
          3        DO_FCALL                                      0  $2      
          4      > RETURN                                                   $2
  100     5*       INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
          6*       SEND_VAR_EX                                              !0
          7*       FETCH_CONSTANT                                   ~3      'MCRYPT_DEV_URANDOM'
          8*       SEND_VAL_EX                                              ~3
          9*       DO_FCALL                                      0  $4      
         10*       ASSIGN                                                   !1, $4
  101    11*       TYPE_CHECK                                    4          !1
         12*       JMPZ                                                     ~6, ->17
  102    13*       NEW                                              $7      'CannotPerformOperationException'
         14*       DO_FCALL                                      0          
         15*       THROW                                         0          $7
         16*       JMP                                                      ->18
  104    17*       RETURN                                                   !1
  106    18*     > RETURN                                                   null

End of function securerandom

Function plainencrypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 44
Branch analysis from position: 41
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 58
Branch analysis from position: 55
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 67
Branch analysis from position: 64
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkhqO
function name:  PlainEncrypt
number of ops:  69
compiled vars:  !0 = $plaintext, !1 = $key, !2 = $iv, !3 = $crypt, !4 = $block, !5 = $pad, !6 = $ret, !7 = $ciphertext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  110     3        INIT_FCALL_BY_NAME                                       'mcrypt_module_open'
          4        FETCH_CONSTANT                                   ~8      'CIPHER'
          5        SEND_VAL_EX                                              ~8
          6        SEND_VAL_EX                                              ''
          7        FETCH_CONSTANT                                   ~9      'CIPHER_MODE'
          8        SEND_VAL_EX                                              ~9
          9        SEND_VAL_EX                                              ''
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !3, $10
  111    12        TYPE_CHECK                                    4          !3
         13      > JMPZ                                                     ~12, ->17
  112    14    >   NEW                                              $13     'CannotPerformOperationException'
         15        DO_FCALL                                      0          
         16      > THROW                                         0          $13
  116    17    >   INIT_FCALL_BY_NAME                                       'mcrypt_enc_get_block_size'
         18        SEND_VAR_EX                                              !3
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !4, $15
  117    21        STRLEN                                           ~17     !0
         22        MOD                                              ~18     ~17, !4
         23        SUB                                              ~19     !4, ~18
         24        ASSIGN                                                   !5, ~19
  118    25        INIT_FCALL                                               'str_repeat'
         26        INIT_FCALL                                               'chr'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                         $21     
         29        SEND_VAR                                                 $21
         30        SEND_VAR                                                 !5
         31        DO_ICALL                                         $22     
         32        ASSIGN_OP                                     8          !0, $22
  120    33        INIT_FCALL_BY_NAME                                       'mcrypt_generic_init'
         34        SEND_VAR_EX                                              !3
         35        SEND_VAR_EX                                              !1
         36        SEND_VAR_EX                                              !2
         37        DO_FCALL                                      0  $24     
         38        ASSIGN                                                   !6, $24
  121    39        IS_NOT_IDENTICAL                                         !6, 0
         40      > JMPZ                                                     ~26, ->44
  122    41    >   NEW                                              $27     'CannotPerformOperationException'
         42        DO_FCALL                                      0          
         43      > THROW                                         0          $27
  125    44    >   INIT_FCALL_BY_NAME                                       'mcrypt_generic'
         45        SEND_VAR_EX                                              !3
         46        SEND_VAR_EX                                              !0
         47        DO_FCALL                                      0  $29     
         48        ASSIGN                                                   !7, $29
  126    49        INIT_FCALL_BY_NAME                                       'mcrypt_generic_deinit'
         50        SEND_VAR_EX                                              !3
         51        DO_FCALL                                      0  $31     
         52        ASSIGN                                                   !6, $31
  127    53        TYPE_CHECK                                  1014          !6
         54      > JMPZ                                                     ~33, ->58
  128    55    >   NEW                                              $34     'CannotPerformOperationException'
         56        DO_FCALL                                      0          
         57      > THROW                                         0          $34
  130    58    >   INIT_FCALL_BY_NAME                                       'mcrypt_module_close'
         59        SEND_VAR_EX                                              !3
         60        DO_FCALL                                      0  $36     
         61        ASSIGN                                                   !6, $36
  131    62        TYPE_CHECK                                  1014          !6
         63      > JMPZ                                                     ~38, ->67
  132    64    >   NEW                                              $39     'CannotPerformOperationException'
         65        DO_FCALL                                      0          
         66      > THROW                                         0          $39
  135    67    > > RETURN                                                   !7
  136    68*     > RETURN                                                   null

End of function plainencrypt

Function encrypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/WkhqO
function name:  Encrypt
number of ops:  69
compiled vars:  !0 = $plaintext, !1 = $key, !2 = $keysize, !3 = $ekey, !4 = $ivsize, !5 = $iv, !6 = $ciphertext, !7 = $akey, !8 = $auth
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  138     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  141     2        STRLEN                                           ~9      !1
          3        FETCH_CONSTANT                                   ~10     'KEY_BYTE_SIZE'
          4        IS_NOT_IDENTICAL                                         ~9, ~10
          5      > JMPZ                                                     ~11, ->10
  143     6    >   NEW                                              $12     'CannotPerformOperationException'
          7        SEND_VAL_EX                                              'Bad+key.'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $12
  147    10    >   FETCH_CONSTANT                                   ~14     'KEY_BYTE_SIZE'
         11        ASSIGN                                                   !2, ~14
  148    12        INIT_FCALL                                               'hkdf'
         13        FETCH_CONSTANT                                   ~16     'HASH_FUNCTION'
         14        SEND_VAL                                                 ~16
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !2
         17        FETCH_CONSTANT                                   ~17     'ENCRYPTION_INFO'
         18        SEND_VAL                                                 ~17
         19        DO_FCALL                                      0  $18     
         20        ASSIGN                                                   !3, $18
  151    21        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
         22        FETCH_CONSTANT                                   ~20     'CIPHER'
         23        SEND_VAL_EX                                              ~20
         24        FETCH_CONSTANT                                   ~21     'CIPHER_MODE'
         25        SEND_VAL_EX                                              ~21
         26        DO_FCALL                                      0  $22     
         27        ASSIGN                                                   !4, $22
  152    28        TYPE_CHECK                                    4  ~24     !4
         29      > JMPNZ_EX                                         ~24     ~24, ->32
         30    >   IS_SMALLER_OR_EQUAL                              ~25     !4, 0
         31        BOOL                                             ~24     ~25
         32    > > JMPZ                                                     ~24, ->36
  153    33    >   NEW                                              $26     'CannotPerformOperationException'
         34        DO_FCALL                                      0          
         35      > THROW                                         0          $26
  155    36    >   INIT_FCALL                                               'securerandom'
         37        SEND_VAR                                                 !4
         38        DO_FCALL                                      0  $28     
         39        ASSIGN                                                   !5, $28
  157    40        INIT_FCALL                                               'plainencrypt'
         41        SEND_VAR                                                 !0
         42        SEND_VAR                                                 !3
         43        SEND_VAR                                                 !5
         44        DO_FCALL                                      0  $30     
         45        CONCAT                                           ~31     !5, $30
         46        ASSIGN                                                   !6, ~31
  160    47        INIT_FCALL                                               'hkdf'
         48        FETCH_CONSTANT                                   ~33     'HASH_FUNCTION'
         49        SEND_VAL                                                 ~33
         50        SEND_VAR                                                 !1
         51        FETCH_CONSTANT                                   ~34     'KEY_BYTE_SIZE'
         52        SEND_VAL                                                 ~34
         53        FETCH_CONSTANT                                   ~35     'AUTHENTICATION_INFO'
         54        SEND_VAL                                                 ~35
         55        DO_FCALL                                      0  $36     
         56        ASSIGN                                                   !7, $36
  161    57        INIT_FCALL                                               'hash_hmac'
         58        FETCH_CONSTANT                                   ~38     'HASH_FUNCTION'
         59        SEND_VAL                                                 ~38
         60        SEND_VAR                                                 !6
         61        SEND_VAR                                                 !7
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $39     
         64        ASSIGN                                                   !8, $39
  162    65        CONCAT                                           ~41     !8, !6
         66        ASSIGN                                                   !6, ~41
  164    67      > RETURN                                                   !6
  165    68*     > RETURN                                                   null

End of function encrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.26 ms | 1426 KiB | 32 Q