有谁知道以下函数中使用的校验和算法的正式/正式名称?
function Checksum($number, $encode = true)
{
if ($encode === true)
{
$result = 0;
$number = str_split($number, 1);
foreach ($number as $value)
{
$result = ($result + ord($value) - 48) * 10 % 97;
}
return implode('', $number) . sprintf('%02u', (98 - $result * 10 % 97) % 97);
}
else if ($number === Checksum(substr($number, 0, -2), true))
{
return substr($number, 0, -2);
}
return false;
}
function ifMB($entity, $reference, $amount = 0.00)
{
$stack = 923;
$weights = array(62, 45, 53, 15, 50, 5, 49, 34, 81, 76, 27, 90, 9, 30, 3);
$argument = str_split(sprintf('%03u%04u%08u', $entity, $reference, round($amount * 100)), 1);
foreach ($argument as $key => $value)
{
$stack += $value * $weights[$key];
}
return sprintf('%03u%04u%02u', $entity, $reference, 98 - ($stack % 97));
}
谢谢!