- hash_hmac: documentation ( source)
- strtoupper: documentation ( source)
- pack: documentation ( source)
<?php
$string = '5 11.48 3 USD 6 771446 16 IT Books. Qty: 2 17 Books Online Inc. 14 www.sample.com 15 123456789012345 8 99999999 19 pgw@mail.sample.com 1 1 --14 20030105153021 16 F2B2DD7E603A7ADA 33 https://www.sample.com/shop/reply';
$key = pack('H*', '00112233445566778899AABBCCDDEEFF');
$expected = 'FACC882CA67E109E409E3974DDEDA8AAB13A5E48';
$result = hash_hmac('sha1', $string, $key);
$result = strtoupper($result);
echo "Expected: $expected".PHP_EOL;
echo "Actual result: $result".PHP_EOL;