Hacker News new | past | comments | ask | show | jobs | submit login
UUID1 vs. UUID4 (sohamkamani.com)
3 points by peteforde on March 8, 2018 | hide | past | favorite | 1 comment



  UUID v1 is generated by using a combination the host
  computers MAC address and the current date and time.
  ...

  This means you are guaranteed to get a completely unique ID,
  unless you generate it from the same computer, and at the
  exact same time. In that case, the chance of collision
  changes from impossible to very very small because of the
  random bits.
MAC addresses are hardly unique. There have been cases where manufacturers accidentally shipped ethernet controllers in bulk with cloned MAC addresses. In addition, they can often be explicitly set by software, so I have no doubt there are IT departments who abuse this feature. And perhaps most likely of all are collisions with MAC addresses generated by VM managers.

Assuming your PRNG isn't broken, your best bet by far for avoiding collisions is a randomly generated UUID.

  Each and every bit of a UUID v4 is generated randomly and . 
  with no inherent logic. It’s that simple. There is,
  therefore, no question of anonymity. ...

  With the sheer number of possible combinations (2^128)....
This is totally wrong. It's like the author didn't bother reading the standard or the Wikipedia article. There are 6 non-random bits in a version 4 UUID. But don't take my word for it. See https://tools.ietf.org/html/rfc4122.html#section-4.4




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: