Dell serial number to UUID transform

This week’s useless exercise is about transforming between Dell serial numbers and UUIDs (in network byte order). Here’s an example showing how it works. The vv indicates direct ascii en/decoding and xx are unused constants. Those constants might mean something, but I have no idea what.

44 45 4c 4c - 33 00 - 10 34 - 80 36 - c4 c0 4f 32 33 4a
 D  E  L  L   vv xx - xx vv   xx vv   || xx xx vv vv vv
                                      ||
            +---<---- AND 0x7f ---<---++
            +--->----  OR 0x80 --->---++
            |
            D  3          4       6             2  3  J

Doing the en/decoding in Python:

import binascii

def decodeuuid(uuid):
    data = binascii.unhexlify(uuid.replace('-',''))
    assert len(data) == 16
    return ''.join([
        chr(ord(data[10]) & 0x7f),
        data[4],
        data[7],
        data[9],
        data[13:]   
    ])

def encodeserial(serial):
    assert len(serial) == 7
    return binascii.hexlify('DELL%c%c%c%c%c%c%c%c%c%c%c%c' % (
        serial[1],  
        0x00,
        0x10,
        serial[2],  
        0x80,
        serial[3],  
        ord(serial[0]) | 0x80,
        0xc0,
        0x4f,
        serial[4],  
        serial[5],  
        serial[6],  
    ))

I originally wanted to fix a blank serial number on a system. It has UUID 44454c4c-0000-1020-8020-80c04f202020, and I thought I could derive the serial from that. Of course it turns out that the serial was just spaces after decoding. This indicates that the UUID is generated from the serial number and not the other way around.

Advertisements

One thought on “Dell serial number to UUID transform

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s