本帖最后由 user11 于 2012-4-9 23:02 编辑
PIN码第八位校验值的计算方法【int】
源码是C,AU3不熟悉,无符号的整型是?AU3输出 和 C 不一样, 。Int main()
{
unsigned Int wps_pin_checksum(unsigned Int pin);
Int Pin=1234567;
printf("Checknum:%d\n",wps_pin_checksum(pin));
Return 0;
}
unsigned int wps_pin_checksum(unsigned int pin)
{
unsigned int accum = 0;
while (pin)
{
accum += 3 * (pin % 10);
pin /= 10;
accum += pin % 10;
pin /= 10;
}
return (10 – accum % 10) % 10;
}
Dim $pin, $accum=0
$pin=Int("1234567")
While $pin
$accum+=3*Mod($pin,10)
$pin/=10
$accum+=Mod($pin,10)
$pin/=10
WEnd
$result=Mod(10-Mod($accum,10),10)
MsgBox(0,"",Int($result))
|