3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDigest( $password, $data ) { $firstEncoding = base64_encode(hash('sha512', $data, true)); $withPass = $firstStep . $password; return base64_encode(hash('sha512', $withPass, true)); } $password= 'PASSWORD'; $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><payment><type>PAY_PAGE_AUTH_CAPTURE_INITIALISATION</type><mer chant><merchantid>10000001</merchantid><accountid>20000001</accountid></merchant>< customer><customerid>1</customerid><email>test@test.com</email><name>Test Client</name><dateofbirth>03042000</dateofbirth><address><addressline1>123 Street</addressline1><addressline2></addressline2><city>Guildford</city><province>Surrey</ province><postcode>GU2 2YG</postcode><country>GBR</country></address><mobilenumber>01234123123</mobilenu mber></customer><transaction><amount>1000</amount><currency>USD</currency><mercha ntref>3DIIWxxbGjhPR7g0OSk8</merchantref></transaction><url><responseurl>https://localho st:8443/response</responseurl></url></payment>'; $first = 'ClKm6nuJYhM29fpYYf1zv2mJ4WdS6DZ6RMwvg8BCiCvLA3Nv1HtKh1YK30F1ljNOVWGEcuc9Mmim2DIVI4s+2w=='; echo $first.PHP_EOL; echo $first.$password.PHP_EOL; $second = base64_encode(hash('sha512', $first, true)); echo $second.PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C7dM7
function name:  (null)
number of ops:  20
compiled vars:  !0 = $password, !1 = $xml, !2 = $first, !3 = $second
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'PASSWORD'
    8     1        ASSIGN                                                   !1, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%0Astandalone%3D%22yes%22%3F%3E%3Cpayment%3E%3Ctype%3EPAY_PAGE_AUTH_CAPTURE_INITIALISATION%3C%2Ftype%3E%3Cmer%0Achant%3E%3Cmerchantid%3E10000001%3C%2Fmerchantid%3E%3Caccountid%3E20000001%3C%2Faccountid%3E%3C%2Fmerchant%3E%3C%0Acustomer%3E%3Ccustomerid%3E1%3C%2Fcustomerid%3E%3Cemail%3Etest%40test.com%3C%2Femail%3E%3Cname%3ETest%0AClient%3C%2Fname%3E%3Cdateofbirth%3E03042000%3C%2Fdateofbirth%3E%3Caddress%3E%3Caddressline1%3E123%0AStreet%3C%2Faddressline1%3E%3Caddressline2%3E%3C%2Faddressline2%3E%3Ccity%3EGuildford%3C%2Fcity%3E%3Cprovince%3ESurrey%3C%2F%0Aprovince%3E%3Cpostcode%3EGU2%0A2YG%3C%2Fpostcode%3E%3Ccountry%3EGBR%3C%2Fcountry%3E%3C%2Faddress%3E%3Cmobilenumber%3E01234123123%3C%2Fmobilenu%0Amber%3E%3C%2Fcustomer%3E%3Ctransaction%3E%3Camount%3E1000%3C%2Famount%3E%3Ccurrency%3EUSD%3C%2Fcurrency%3E%3Cmercha%0Antref%3E3DIIWxxbGjhPR7g0OSk8%3C%2Fmerchantref%3E%3C%2Ftransaction%3E%3Curl%3E%3Cresponseurl%3Ehttps%3A%2F%2Flocalho%0Ast%3A8443%2Fresponse%3C%2Fresponseurl%3E%3C%2Furl%3E%3C%2Fpayment%3E'
   20     2        ASSIGN                                                   !2, 'ClKm6nuJYhM29fpYYf1zv2mJ4WdS6DZ6RMwvg8BCiCvLA3Nv1HtKh1YK30F1ljNOVWGEcuc9Mmim2DIVI4s%2B2w%3D%3D'
   21     3        CONCAT                                           ~7      !2, '%0A'
          4        ECHO                                                     ~7
   22     5        CONCAT                                           ~8      !2, !0
          6        CONCAT                                           ~9      ~8, '%0A'
          7        ECHO                                                     ~9
   23     8        INIT_FCALL                                               'base64_encode'
          9        INIT_FCALL                                               'hash'
         10        SEND_VAL                                                 'sha512'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !3, $11
   24    17        CONCAT                                           ~13     !3, '%0A'
         18        ECHO                                                     ~13
         19      > RETURN                                                   1

Function getdigest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C7dM7
function name:  getDigest
number of ops:  23
compiled vars:  !0 = $password, !1 = $data, !2 = $firstEncoding, !3 = $withPass, !4 = $firstStep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'base64_encode'
          3        INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'sha512'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !2, $6
    4    11        CONCAT                                           ~8      !4, !0
         12        ASSIGN                                                   !3, ~8
    5    13        INIT_FCALL                                               'base64_encode'
         14        INIT_FCALL                                               'hash'
         15        SEND_VAL                                                 'sha512'
         16        SEND_VAR                                                 !3
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                         $11     
         21      > RETURN                                                   $11
    6    22*     > RETURN                                                   null

End of function getdigest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.96 ms | 1392 KiB | 17 Q