3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $headers = array( 'x-wix-event-type' => '/provision/provision', 'x-wix-timestamp' => '2013-09-30T10:46:38.993Z', 'x-wix-signature' => 'BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I', 'x-wix-application-id' => '1306dc69-eb2f-493d-fc98-f4e693829367', 'x-wix-instance-id'=> '1328a7fe-e451-8780-d201-0c5d9a1fc02b', 'x-wix-event-id'=> '2cdae256-750f-4cc8-bbde-b35018bf8ceb' ); $body = '{"instance-id":"1328a7fe-e451-8780-d201-0c5d9a1fc02b"}'; $key = "8bbb74b1-8864-47b3-804f-04925bf3ffba"; function concat($request, $headers, $body) { $result = ''; $result .= $request; $result .= "\n"; $headers = ksort($headers); foreach ($headers as $header => $value) { if ($header != 'x-wix-signature') { $result = $result . $header . ': ' . $value; } } $result = $result . "\n" . $body; return $result; } $concat = concat($request, $headers, $body); $encrypted = hash_hmac('sha256', $concat, $key); $base64 = base64_encode($encrypted); echo "The computed signature is : " . $base64 . "\n"; echo "The signature sent by Wix : " . $headers['x-wix-signature'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gklRf
function name:  (null)
number of ops:  27
compiled vars:  !0 = $request, !1 = $headers, !2 = $body, !3 = $key, !4 = $concat, !5 = $encrypted, !6 = $base64
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'POST'
    4     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, '%7B%22instance-id%22%3A%221328a7fe-e451-8780-d201-0c5d9a1fc02b%22%7D'
   15     3        ASSIGN                                                   !3, '8bbb74b1-8864-47b3-804f-04925bf3ffba'
   35     4        INIT_FCALL                                               'concat'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0  $11     
          9        ASSIGN                                                   !4, $11
   36    10        INIT_FCALL                                               'hash_hmac'
         11        SEND_VAL                                                 'sha256'
         12        SEND_VAR                                                 !4
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !5, $13
   37    16        INIT_FCALL                                               'base64_encode'
         17        SEND_VAR                                                 !5
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !6, $15
   39    20        CONCAT                                           ~17     'The+computed+signature+is+%3A+', !6
         21        CONCAT                                           ~18     ~17, '%0A'
         22        ECHO                                                     ~18
   40    23        FETCH_DIM_R                                      ~19     !1, 'x-wix-signature'
         24        CONCAT                                           ~20     'The+signature+sent+by+Wix+%3A+', ~19
         25        ECHO                                                     ~20
         26      > RETURN                                                   1

Function concat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/gklRf
function name:  concat
number of ops:  26
compiled vars:  !0 = $request, !1 = $headers, !2 = $body, !3 = $result, !4 = $value, !5 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   19     3        ASSIGN                                                   !3, ''
   20     4        ASSIGN_OP                                     8          !3, !0
   21     5        ASSIGN_OP                                     8          !3, '%0A'
   22     6        INIT_FCALL                                               'ksort'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !1, $9
   24    10      > FE_RESET_R                                       $11     !1, ->20
         11    > > FE_FETCH_R                                       ~12     $11, !4, ->20
         12    >   ASSIGN                                                   !5, ~12
   25    13        IS_NOT_EQUAL                                             !5, 'x-wix-signature'
         14      > JMPZ                                                     ~14, ->19
   26    15    >   CONCAT                                           ~15     !3, !5
         16        CONCAT                                           ~16     ~15, '%3A+'
         17        CONCAT                                           ~17     ~16, !4
         18        ASSIGN                                                   !3, ~17
   24    19    > > JMP                                                      ->11
         20    >   FE_FREE                                                  $11
   30    21        CONCAT                                           ~19     !3, '%0A'
         22        CONCAT                                           ~20     ~19, !2
         23        ASSIGN                                                   !3, ~20
   32    24      > RETURN                                                   !3
   33    25*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.26 ms | 1403 KiB | 20 Q