jeudi 28 avril 2016

How do I customize random UUIDs?

In general I'm using Type 5 random UUIDs as primary to store my data in a database. No I have got the situation, where I would like to store additional information (i. e. mobile vs. landline) within the UUID. Now I could easily set (i. e.) the last bit depending on this information. Strictly speaking it's not a Type 5 anymore and in my case I'm thinking about manipulating 8 bits. So now I'm asking myself, why shouldn't I create a random 128 bit number, which ignores variant and version? All variants except RFC 4122 are reserved or for backward compatibility reasons. Why do I need any information like variant or version, if my application knows, what kind it handles? It's just waste of 6 bits. Do I risk to get side effects ignoring those bits? Java seems to accept all random numbers and Cassandra also... I know, the probability of reduction is rather insignificantly, but actually I'm interested, why I should retain those bits.




Aucun commentaire:

Enregistrer un commentaire