Bruce Fitzsimons <>
Tue May 16 07:50:16 CEST 2006


You may or may not be aware that the CDMA/3GPP2 side of the mobile world
is changing its mobile handset identifier from an Electronic Serial
Number (ESN) to a Mobile Equipment Identifier (MEID) due to having sold
far too many phones :-) (...and it was only 24 bits).

MEIDs are effectively the same as GSM IMEIs but use a different range of
manufacturer codes and a different check-digit calculation. See 3GPP2
X.S0008 if you want to see more/are a masochist.

Why is this on the Erlang list? Well I've implemented a small page in
Yaws/Erlang that allows validation of the check-digits and the
calculation of the psuedo-ESN (used for backward compatibility). It was
a pleasant experience to implement the SHA-1 hashing (using crypto) and
the 2x LUHN checkdigit calculations. I must say that converting
standards specifications into an Erlang implementation is far nicer than
doing it in C/C++/Java.

Some examples: - 3GPP2 example

Some helpful hints for the archive:

* shows a nice way of
converting hex numbers in ASCII to usable integers (credit:
BrentAFulgham <>)
* Using lists:flatten(string:tokens(String, " ")) is an easy, brute
force, way to kill user formatting of input numbers (assuming formatting
is irrelevant)
* io_lib:format outputs unflattened lists when padding which will cause
grief if you expect a flat "string" in later processing.


More information about the erlang-questions mailing list