3v4l.org

run code in 300+ PHP versions simultaneously
<?php $signature = 'sha512=FDE5518801C115C4886311877B4C37F6C26ABACE01ADB973EF372FB51C8F1E5321A83717161AD7DEFFD46F5013900E68B6220F3B25E9302A4208A9C673D32749'; $json = '{"notificationId":"4bbba8fb-1d32-46b6-a513-a9ca2fed885c","eventType":"net.authorize.customer.subscription.created","eventDate":"2019-11-27T06:20:36.3621687Z","webhookId":"a2929d59-147e-4400-a2bb-b3bd25a0311d","payload":{"name":"Test subscription","amount":290.00,"status":"active","profile":{"customerProfileId":1921894828,"customerPaymentProfileId":1834842681,"customerShippingAddressId":1879009509},"entityName":"subscription","id":"6168233"}}'; $secret = 'F7B582AFFA9372866965456CFAC0D1B1219258F955FD5266D1A96BF9BE3C85F7D54C7CDFF9EF3EE7D3916EACB5EE920167F557BBB307288C17FBD169F0257AB4'; //To check the header and signature is true if (hash_equals(strtolower($signature), 'sha512=' . hash_hmac('sha512', $json, $secret))) { echo 'valid'; }else{ echo 'invalid'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rn87X
function name:  (null)
number of ops:  21
compiled vars:  !0 = $signature, !1 = $json, !2 = $secret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'sha512%3DFDE5518801C115C4886311877B4C37F6C26ABACE01ADB973EF372FB51C8F1E5321A83717161AD7DEFFD46F5013900E68B6220F3B25E9302A4208A9C673D32749'
    4     1        ASSIGN                                                   !1, '%7B%22notificationId%22%3A%224bbba8fb-1d32-46b6-a513-a9ca2fed885c%22%2C%22eventType%22%3A%22net.authorize.customer.subscription.created%22%2C%22eventDate%22%3A%222019-11-27T06%3A20%3A36.3621687Z%22%2C%22webhookId%22%3A%22a2929d59-147e-4400-a2bb-b3bd25a0311d%22%2C%22payload%22%3A%7B%22name%22%3A%22Test+subscription%22%2C%22amount%22%3A290.00%2C%22status%22%3A%22active%22%2C%22profile%22%3A%7B%22customerProfileId%22%3A1921894828%2C%22customerPaymentProfileId%22%3A1834842681%2C%22customerShippingAddressId%22%3A1879009509%7D%2C%22entityName%22%3A%22subscription%22%2C%22id%22%3A%226168233%22%7D%7D'
    5     2        ASSIGN                                                   !2, 'F7B582AFFA9372866965456CFAC0D1B1219258F955FD5266D1A96BF9BE3C85F7D54C7CDFF9EF3EE7D3916EACB5EE920167F557BBB307288C17FBD169F0257AB4'
    8     3        INIT_FCALL                                               'hash_equals'
          4        INIT_FCALL                                               'strtolower'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        INIT_FCALL                                               'hash_hmac'
          9        SEND_VAL                                                 'sha512'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $7      
         13        CONCAT                                           ~8      'sha512%3D', $7
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                         $9      
         16      > JMPZ                                                     $9, ->19
    9    17    >   ECHO                                                     'valid'
         18      > JMP                                                      ->20
   11    19    >   ECHO                                                     'invalid'
   12    20    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.15 ms | 1401 KiB | 19 Q