0
チェックサムの生成と支払いトランザクションの検証のためにノードJで次の関数を書き直そうとしています。ノードJS内の指定された文字列のチェックサムを生成して確認する方法
私はNode Jsに変換する必要があるService Provideのコードを入手しました。私はバックエンドとしてエクスプレスを使用しています。
<?php
function generateChecksum($transId,$sellingCurrencyAmount,$accountingCurrencyAmount,$status, $rkey,$key)
{
$str = "$transId|$sellingCurrencyAmount|$accountingCurrencyAmount|$status|$rkey|$key";
$generatedCheckSum = md5($str);
return $generatedCheckSum;
}
function verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $key, $checksum)
{
$str = "$paymentTypeId|$transId|$userId|$userType|$transactionType|$invoiceIds|$debitNoteIds|$description|$sellingCurrencyAmount|$accountingCurrencyAmount|$key";
$generatedCheckSum = md5($str);
// echo $str."<BR>";
// echo "Generated CheckSum: ".$generatedCheckSum."<BR>";
// echo "Received Checksum: ".$checksum."<BR>";
if($generatedCheckSum == $checksum)
return true ;
else
return false ;
}
?>
どのようにパラメータを渡して次のコードをJavascriptで記述できますか?
は、いくつかのMD5の実装のために、この[SO](https://stackoverflow.com/questions/14733374/how-to-generate-md5-file-hash-on-javascript)質問を見てください。 –