- hash: documentation ( source)
- base64_encode: documentation ( source)
<?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;