# Cyrozap's Tech Projects

## Computers. Circuits. Code.

Approximately three years ago, I posted instructions on how to get an iPad data plan without having to own an iPad. Just for fun, I decided to check if that method still works and, well, it does! It has been three years, though, and I'd like to offer some improvements to the process using knowledge I've gained since my original post.

## IMEI Check Digit

First of all, in my original post, I said that "The IMEI should be in the form of 01222300******* or 01222400*******, where ******* is a random 7-digit number." This is not entirely accurate—the last digit of an IMEI is actually a check digit and not just any random digit. This would explain why some iPad IMEI's would work and some wouldn't. Thankfully, the algorithm to generate these digits is publicly available and there are plenty of websites that can calculate this number for you. If you would rather use some code to do this, the Python implementation on the Wikipedia Page is useful:

```def luhn_checksum(card_number):
def digits_of(n):
return [int(d) for d in str(n)]
digits = digits_of(card_number)
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
checksum = 0
checksum += sum(odd_digits)
for d in even_digits:
checksum += sum(digits_of(d*2))
return checksum % 10

def calculate_luhn(partial_card_number):
check_digit = luhn_checksum(int(partial_card_number) * 10)
return check_digit if check_digit == 0 else 10 - check_digit
```

So, the revised instructions should really be, "The IMEI should be in the form of 01222300******X or 01222400******X, where ****** is a random 6-digit number and "X" is the Luhn check digit." In code, this would be:

```import random
num_digits = 6
random_digits = random.randint(0, 10**num_digits)