|
Welcome to the GSM-Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Only registered members may post questions, contact other members or search our database of over 8 million posts. Registration is fast, simple and absolutely free so please - Click to REGISTER! If you have any problems with the registration process or your account login, please contact contact us . |
|
Register | FAQ | Donate | Forum Rules | Root any Device | ★iPhone Unlock★ | ★ Direct Codes ★ | Direct Unlock Source |
| LinkBack | Thread Tools | Display Modes |
03-25-2018, 01:10 | #1 (permalink) |
Freak Poster Join Date: May 2006 Location: Malaysia Kuala Lumpur
Posts: 494
Member: 276082 Status: Offline Thanks Meter: 113 | ICCID check sum coding 校验代码 unsigned char getIccidLastNumber_fun(unsigned char *pSrc)//iccid检验函数 { unsigned char len=19; unsigned char i; unsigned char tmp[19]; unsigned char asciiFlag=0; int sum=0; for(i=0;i<len;i++) { tmp[i]=pSrc[i]; if(tmp[i]>=0x30) { tmp[i]-=0x30; asciiFlag=1; } tmp[i]=tmp[i]%10; } for(i=0;i<len;i++) { if((i&0x01) == 0) { tmp[i]*=2; tmp[i]=(tmp[i]/10) + (tmp[i]%10); } } for(i=0;i<len;i++) { sum+=tmp[i]; } sum%=10; if(sum) { sum=10-sum; } if(asciiFlag) { sum+=0x30; } return sum; } |
Bookmarks |
| |
|