# CDMA Hardware Identifiers - ESN, MEID, pESN

## Introduction

CDMA systems require a (mostly) unique identifier for mobile devices. This identifier is specific to the device, and can't (easily) be changed, unlike a phone number (also known as a "MIN"). There are two major identifier types - the older Electronic Serial Number (ESN) and the newer Mobile Equipment Identifier (MEID). Both identifiers have multiple presentation formats, and it can be tricky to determine how to actually identify a device if you're given a number in an unknown format. This document aims to demystify ESNs and MEIDs.

## Electronic Serial Number (ESN)

ESNs are managed by the Telecom Industry Association. They are 32 bits long (that is, they can be described by a sequence of 32 1's and 0's), and identify the **manufacturer** of a mobile device and also the **serial number** assigned to the device by that manufacturer.

The basic format for ESNs consists of 8 bits to specify the manufacturer and 24 bits to specify the serial number:

The 8 bits of the manufacturer portion lead to 256 (2^8) different possible manufacturer codes. Some codes are reserved, however: numbers `0`

through `18`

, `128`

, `250`

, and `255`

are not to be used as normal ESNs.

For manufacturer codes `0`

through `17`

, `250`

, and `255`

, the manufacturer code is 14 bits and the serial number is 18 bits.

Code `128`

is discussed below in the pESN section.

It's usually most convenient to assume the standard format, and treat the reserved codes as exceptions.

The 32 binary bits can be expressed in several ways, but the two recognized ways are:

**8 character hex code:**A 2 character hexadecimal code to represent the manufacturer, and a 6 character hex code to represent the serial number. This is the most widely used format. Examples:`0x0106C01B8`

(using 0x to indicate that a hex value follows),`0hC3B80`

(using 0h to indicate that a hex value follows),`e5ab0134b`

(without a prefix).**11 digit decimal code**: A 3 digit decimal number to represent the manufacturer, and an 8 digit decimal number to represent the serial number. Examples:`23981037459`

,`24110201020`

. This is the second most widely used format.- Beware: some programs (e.g. Microsoft Excel) strip off leading 0's, making it difficult to tell whether you're looking at a decimal ESN. For example, a code of
`01924100142`

might show up as`1924100142`

. You might have as few as 8 digits (a manufacturer code of`000`

), or 9 digits (reserved manufacturer codes`001`

through`009`

).

- Beware: some programs (e.g. Microsoft Excel) strip off leading 0's, making it difficult to tell whether you're looking at a decimal ESN. For example, a code of

To convert between the two, break up your code (in either format) into a manufacturer block and a serial number block, convert the block to/from decimal/hex separately, then concatenate the two blocks. Make sure the blocks start and end with the correct number of hex characters/decimal digits.

- Hex format to decimal format example:
`0x0106C01B8`

breaks into`0x10`

and`0x6C01B8`

.`0x10`

in decimal is`16`

, and`0x6C01B8`

is`7078328`

. The converted ESN is`167078328`

. - Decimal format to hex format example:
`067078328`

breaks into`067`

and`078328`

.`067`

in hex is`0x43`

, and`078328`

is`0x131F8`

. The converted ESN is`0x43131F8`

.

Some improper, but not-uncommon ways of representing ESNs are:

- Converting the 11 digit decimal code above straight to hexadecimal (i.e. not splitting it into 3 digits for the manufacturer and 8 for the serial number). This can be difficult to detect, as they are also 8 hex digits. If you have a set of 8 character hex codes, check the manufacturer codes. If you consistently see an uncommon (for you) manufacturer, someone may have given you the ESN in this improper format. To correct this, convert the hex number back to decimal, then split up the manufacturer (3 digits) and serial number (8 digits).
- Converting the 8 character hex code above straight to decimal (i.e. not splitting it into 2 characters for the manufacturer and 6 for the serial number). This is a little bit easier to detect than the previous improper format, as these will be a maximum of 10 decimal digits (2^32 - 1 =4,294,967,295). To correct this, convert the decimal number back to hex, then split up the manufacturer (2 characters) and the serial number (6 characters).

### Resources for ESNs:

## Mobile Equipment Identifier (MEID)

MEID's are also manged by the TIA. These are 56 bits long, and like ESN's, identify the **manufacturer** of a mobile device as well as the **serial number** assigned to the device by that manufacturer.

The MEID consists of 32 bits to specify the manufacturer and 24 bits to specify the serial number: The first 4 bits of the manufacturer code are "reserved," and restricted to just a few values. There can also be a 4 bit "check digit" appended to the end, but this is not transmitted between the mobile device and the CDMA system (according to 3GPP2 S.R0048-A) and is not common to see.

There are two proper ways to represent MEIDs:

**14 character hex code**: An 8 character hex code to represent the manufacturer (2 for the reserved portion, 6 for the actual manufacturer portion), and a 6 character hex code to represent the serial number. This is the most widely used format. Examples:`0xA10000009296F2`

(using 0x to indicate that a hex value follows),`0hA00000003FF642`

(using 0h to indicate that a hex value follows),`ff000000b2c63a`

(without a prefix).**18 digit decimal code**: A 10 digit decimal number to represent the manufacturer, and an 8 digit decimal number to represent the serial number. Example:`268435456010201020`

.

To convert between the two, break up your code (in either format) into a manufacturer block and a serial number block, convert the block to/from decimal/hex separately, then concatenate the two blocks. Make sure the blocks start and end with the correct number of hex characters/decimal digits.

- Hex format to decimal format example:
`0xA10000009296F2`

breaks into`0xA1000000`

and`0x9296F2`

.`0xA1000000`

in decimal is`2701131776`

, and`0x9296F2`

is`9606898`

. The converted manufacturer block is OK (10 decimal digits), but the serial number block is one short (it's 7 instead of 8), so we prepend a 0 to it. The converted MEID is`270113177609606898`

(18 decimal digits). - Decimal format to hex format example:
`268435456010201020`

breaks into`2684354560`

and`10201020`

.`2684354560`

in hex is`0xA0000000`

, and`10201020`

is`0x9BA7BC`

. The converted MEID is`0xA00000009BA7BC`

.

Some improper, but not-uncommon ways of representing MEIDs are:

- Converting the 18 digit decimal code above straight to hexadecimal (i.e. not splitting it into 10 digits for the manufacturer and 8 for the serial number). To correct this, convert the hex number back to decimal, then split up the manufacturer (10 digits) and serial number (8 digits).
- Converting the 14 character hex code above straight to decimal (i.e. not splitting it into 8 characters for the manufacturer and 6 for the serial number). To correct this, convert the decimal number back to hex, then split up the manufacturer (8 characters) and the serial number (6 characters).

**Tip**: For MEIDs, it can be difficult to convert to/from hex/decimal an improper code, since the numbers are so large (they cause an error if the "integer" type used in whatever conversion routine is not big enough). If you're using Excel:

- VBA code to convert very large numbers from decimal to hex
- VBA code to convert very large numbers from hex to decimal

### Resources for MEID's:

## Pseudo ESN (pESN)

The reserved ESN manufacturer code 128 is for "pseudo ESNs," which allow legacy equipment to recognize MEIDs. pESNs are ESN codes that always begin with 0x80 in the hex format (or 128 in the decimal format, but it is much more convenient to work with the hex format for pESNs). To generate one, you apply the Secure Hash Algorithm 1 (SHA-1) to the MEID, and take the last (least significant) 24 bits (6 hex numbers) of the result, and append them to `0x80`

.

This can be tricky to do, especially if you're using something like Microsoft Excel. You want to apply SHA-1 to the *number* representing the MEID, not the *string* representing the MEID. You'll need to process it byte-by-byte, so you must give it two hex numbers at a time (since two hex numbers make a byte) and make sure they are interpreted as numbers and not ASCII characters.

Examples:

- Given MEID
`0xA0000000002329`

, make a pESN. SHA-1 on`A0000000002329`

gives`e3be267a2cd5c861f3c7ea4224df829a3551f1ab`

. Take the last 6 hex numbers of this result, and append it to`0x80`

- the result is`0x8051F1AB`

. - Given MEID
`0xFF000001123456`

, make a pESN. SHA-1 on "`FF000001123456`

" gives`ffce4beab4c2a7933c0d6d21b21cf21a0e0737e1`

. Take the last 6 hex numbers of this result, and append it to`0x80`

- the result is`0x800737E1`

.