Skip to content

Commit 87314cd

Browse files
Create compute_trans_hashSHA2.php
This is the code to verify anet payments integrity using sha hmac512 algorithm
1 parent e212813 commit 87314cd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Sha512/compute_trans_hashSHA2.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
$apiLogin="2Kfn5S7x7D";
4+
$transId="60115585081";
5+
$amount='12.00';
6+
$signatureKey='56E529FE6C63D60E545F84686096E6AA01D5E18A119F18A130F7CFB3983104216979E95D84C91BDD382AA0875264A63940A2D0AA5548F6023B4C78A9D52C18DA';
7+
$textToHash="^". $apiLogin."^". $transId ."^". $amount."^";
8+
9+
function generateSH512($textToHash, $signatureKey)
10+
{
11+
if ($textToHash != null && $signatureKey != null) {
12+
$sig = hash_hmac('sha512', $textToHash, hex2bin($signatureKey));
13+
echo " Computed SHA512 Hash: " . strtoupper($sig) . "\n";
14+
} else {
15+
echo "Either Signature key or the text to hash is empty \n";
16+
}
17+
}
18+
19+
generateSH512($textToHash, $signatureKey);
20+
?>

0 commit comments

Comments
 (0)