Reputation: 125
I want to understand the logic so that I can implement this algorithm in java. I want to calculate check digit for a valid hexadecimal IMEI number. For example - 6C4BFFC0000004 Please help me with the algorithm. I tried to find solution in google but I could not find correct answer using those algorithm.
Calculation what I did is like -
But the check digit for the above IMEI is 4. I am getting 7. I dont know where I am going wrong.
Upvotes: 3
Views: 2776
Reputation: 424
Actually, you do not need to convert to Decimal first. If you have an "IMEI" in hex it is really an MEID. IMEIs are a decimal-only subset of MEIDs. There is actually a patent out on how to calculate the Luhn for hex-based MEIDs. See claims 0113 through 0119 of the following:
https://patentimages.storage.googleapis.com/74/63/03/3fb507952c7ccf/US20080194223A1.pdf
Upvotes: 1
Reputation: 1239
I have had the same need and I found the solution by using the logic explained on the following website :
Luhn test of credit card numbers
I write a function based on the C example in order to determine the last digit. Behavior will be the same in Java.
Upvotes: 0