Questions tagged [uuid]

24 questions
50
votes
3 answers

Strategy for generating unique and secure identifiers for use in a "sometimes offline" web app

I have a web based project that allows users to work both online and offline and I'm looking for a way to generate unique ids for records on the client side. I'd like an approach that works while a user is offline (i.e. unable to talk to a server),…
33
votes
6 answers

UUID collisions

Has anybody done any real research on the probability of UUID collisions, especially with version 4 (random) UUIDs, given that the random number generators we use aren't truly random and that we might have dozens or hundreds of identical machines…
Paul Tomblin
  • 1,949
26
votes
7 answers

How to generate "language-safe" UUIDs?

I always wanted to use randomly generated strings for my resources' IDs, so I could have shorter URLs like this: /user/4jz0k1 But I never did, because I was worried about the random string generation creating actual words, eg: /user/f*cker. This…
18
votes
2 answers

Why are UUID / GUID's in the format they are?

Globally Unique Identifiers (GUID) are a grouped string with a specific format which I assume has a security reason. A GUID is most commonly written in text as a sequence of hexadecimal digits separated into five groups, such…
Xeoncross
  • 1,213
13
votes
6 answers

Why use a special "Name" class (instead of just a string) for representing object names in C++?

Suppose we have an Instance class in a C++ program, which has a GUID/UUID, name, parents, children, and other properties which can be saved to or loaded from an XML file. The intuitive approach for representing the name of the Instance is to give it…
Bunabyte
  • 643
10
votes
8 answers

A good schema to represent integer numbers from 0 to infinity, assuming you have infinite linear binary storage?

I would like a schema to represent integer numbers starting with 0, without any limit (assuming access to infinite linear storage). Here's a schema that can represent numbers from 0 to 255: Use the first byte of the storage (address 0) to store the…
7
votes
1 answer

Uniformly distributing GUIDS to bucket of size N

How can uniformly and deterministically distribute set of GUIDS to N buckets. N can be as small as 2. Need to make sure the same GUID is always mapped to the same bucket. Can't use any additionally memory. Input GUID set is not known in advance,…
6
votes
3 answers

How to handle primary keys and UUIDs in a database

I've heard advice from several people about using UUIDs as ID in your database. For one this has the benefit of making your URLs unguessable. It also masks how many objects you have in the system. e.g. If your user ID is #412, then you know there…
6
votes
4 answers

Protecting against malicious duplicate IDs in a distributed environment

Let's say we have multiple (somewhat autonomous) (micro-)services, and when entities are created, the ID (UUIDs or whatever) can be set externally. How can we ensure that an ID remains unique across all services while protecting against someone…
4
votes
3 answers

UUID vs Integer

For a database. Should I use an UUID or an integer for the primary key? I will never exceed 2^32 in amount of rows, so an integer should be more than plenty. I would prefer to use an integer, as I find it easier to work with, especially when using…
KaareZ
  • 151
3
votes
2 answers

Generate UUID in Application or Database level?

I created a new application and I am thinking where is the best place to generate a UUID. Generate a UUID in application level and persist it Generate a UUID in Database level I have a feeling that is a better approach to generate the UUID in…
pik4
  • 385
3
votes
2 answers

Accepting the UUID collision risk based on number of clients

After reading some questions about the probability of UUID collisions it seems like collisions although unlikely, are still possible and a conflict solution is still needed. Therefore I am wondering about the background of choosing UUIDs for…
2
votes
3 answers

Should you manually generate UUIDs / GUIDs by modifying an existing UUID / GUID?

As an example imagine I generate a UUID/GUID for an ID in a json file. { "25d01302-2558-4c44-bf9d-385b1cc51377": ["somevalues"] } is it ok or generally frowned upon to do something like { "25d01302-2558-4c44-bf9d-385b1cc51377": ["somevalue"], …
2
votes
1 answer

MySQL UUID storage/presentation

I'm looking at the way UUIDs are stored in MySQL. MySQL 8 still doesn't have a UUID data type, and it still doesn't have custom types, so there are two options - store it as a string or as a binary. Binary form saves 30% of space and performs much…
2
votes
1 answer

How do I create Uuids in DDD Entities/Aggregates

As I am learning DDD to help build an app idea the proper way ;) I have come across a confusing aspect that I am trying to find a solution for. I understand the need for Uuids in an app the size of which I am creating, but I am a little lost as to…
1
2