PDA

View Full Version : IMEI:GUIDE- Description and how to generate checksum



rich hathaway
04-04-2014, 06:07 PM
First off,this is for educational purposes only so lets not get off on a bunch of stuff about changing it.

ok first off a little history about imei

(from wiki)--->IMEI is short for International Mobile Equipment Identity and is a unique number given to every single mobile phone, typically found behind the battery.
IMEI numbers of cellular phones connected to a GSM network are stored in a database (EIR - Equipment Identity Register) containing all valid mobile phone equipment.
When a phone is reported stolen or is not type approved, the number is marked invalid.

Now what it is comprised of---> For the IMEI format prior to 2003, the GSMA guideline was to have this Check Digit always transmitted to the network as zero. This guideline seems to have disappeared for the format valid from 2003 and onwards.

As of 2004, the format of the IMEI is
AA-BBBBBB-CCCCCC-D
although it may not always be displayed this way. The IMEISV drops the Luhn check digit (last digit) in favour of an additional two digits for the Software Version Number (SVN), making the format AA-BBBBBB-CCCCCC-EE


SEE PIC BELOW FOR DETAIL
[Only registered and activated users can see links]


Now that we see how it is made up,lets look at how to calculate the checksum for it.

The checksum is comprised using the "Luhn algorithm",it is really very easy to understand and works like this

[Only registered and activated users can see links]

so really it is just simple math to double every second digit starting with the second,then add the sum of those single digits to get 52(for this imei),now just remember that this sum must be divisible by 10 so we will be adding 8 to get 60 which is divisible by 10 so our checksum will be 8 so our imei is 490154203237518

i have a checksum calc i will post here for you all to use,also i will post some source for you to make your own if you wish.



[hide-thanks]
my tool and 2 sources for your own tools here ----> [Only registered and activated users can see links]


neither of the below sources are mine or are from my tool
both are included in the file above
this source is in c#

private Boolean ValidateIMEI(string IMEI)
{
if (IMEI.Length != 15)
return false;
else
{
Int32[] PosIMEI = new Int32[15];
for (int innlop = 0; innlop < 15; innlop++)
{
PosIMEI[innlop] = Convert.ToInt32(IMEI.Substring(innlop, 1));
if (innlop % 2 != 0) PosIMEI[innlop] = PosIMEI[innlop] * 2;
while (PosIMEI[innlop] > 9) PosIMEI[innlop] = (PosIMEI[innlop] % 10) + (PosIMEI[innlop] / 10);
}

Int32 Totalval = 0;
foreach (Int32 v in PosIMEI) Totalval += v;
if (0 == Totalval % 10)
return true;
else
return false;
}

}

below source is for excel



Option Explicit

Function AddLuhnDigit(target As Range) As String
Dim sTmp As String
Dim i As Integer, iTmp As Integer

For i = 2 To Len(target.Text) Step 2
sTmp = sTmp & (CInt(Mid(target.Text, i, 1)) * 2)
Next i

For i = 1 To Len(sTmp)
iTmp = iTmp + CInt(Mid(sTmp, i, 1))
Next i

For i = 1 To Len(target.Text) Step 2
iTmp = iTmp + CInt(Mid(target.Text, i, 1))
Next i

AddLuhnDigit = target.Text & Iif((10 - (iTmp Mod 10))=10,"0",(10 - (iTmp Mod 10)))

End Function


You can then use it on your sheet like any other formula, so assuming your list of numbers is in column A, then put =AddLuhnDigit(A1) in B1 and copy down.[/hide-thanks]

please feel free to add anything to this thread

AnnaleeRub
04-29-2017, 07:00 PM
Dear Experts, Please to suggest how to improve DL TBF drop due other causes N3105 overflow ? BR, Fahmi - кстати (немного не по теме) пару дней назад наткнулась на хороший сайт, который возвращает часть средств от покупок в интернете! Всем советую [Only registered and activated users can see links]