cactus
@cactus

UUIDs are neat. y'know, cfbff0d1-9375-5685-968c-48ce8b15ae17 type of shit. if you're like me until a few days ago, all you know about the types of UUID is that v4 is the good one. but why are there other ones? is there a secret better one? why are the dashes asymmetrical? let's take a (roughly paraphrased from wikipedia and probably not quite accurate) look.


vikxin
@vikxin

So for a thing at work, I had to learn entirely too much about Bluetooth, and I learned about a thing called "GATT" which is used to provide an...extremely complicated thing that Bluetooth Low Energy uses for defining hierarchies of whatever the fuck this device has accessible.

Anyway, the way the individual GATT tags are identified is that each type of GATT tag has its own UUID. Now you might say, sure, that makes sense, a 128 bit ID is unique enough you won't have any accidental overlaps. Which is, of course, why GATT introduces a concept of a 16-bit UUID.

Wait, what?

It turns out that the Bluetooth spec defines a custom 112 bit UUID "namespace" (0000xxxx-0000-1000-8000-00805f9b34fb) that has assigned numbers for what type of thing it is (from a document called "assigned numbers", of course) that you just slot into the empty 16 bits in that namespace. Which, I mean, I guess kinda makes sense. Assuming you never run out of those 16 bit IDs.

No one has ever regretted making identifiers too few bits. Never.

Anyway, while the assigned numbers haven't run out yet, you'd say, okay sure, just use the full 128-bit UUID filled in with the APIs over the wire (or well, air, I guess), right?

No, you can just use the abridged 16-bit "UUID" and everything is supposed to know what this means without the full 128-bits.

bluetooth, everyone


You must log in to comment.

in reply to @cactus's post:

YOU WROTE THIS ENTIRE POST JUST SO YOU COULD MAKE THAT JOKE AT THE END 🤣

But also, this is extremely informative! I was considering using UUID to uniquely identify all database content in a CMS engine I'm writing from (almost) scratch for my own website, and this gives me a lot more information, concisely summarized, to digest about them! Thank you!

this was a fun read!

you know, ive always rolled my own identifier format (mostly for shits and giggles), and usually when i do so i get a little voice in my head worried that rolling our own is Bad because UUID is The Standard and probably Knows Better. but now i see that the UUID folk are also just having shits and giggles and all of their formats are fucked up too 😌

I had to dig through a lot of that information for a previous job (a predecessor decided that he could design a better scheme, and somehow, nobody kicked him in the shins to stop him, and I needed to kinda-sorta undo that history and replace his "Peculiar-IDs"), so I can confidently say that this is extremely well done.

in reply to @vikxin's post: