TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TIL: Versions of UUID and when to use them

310 pointsby fagnerbrack9 months ago

13 comments

Lammy9 months ago
&gt; UUID Version 2 (v2) is reserved for security IDs with no known details.<p>Only no known details if the only document you&#x27;re reading is the notoriously poorly-specified RFC. Here you go: <a href="https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9696989899&#x2F;chap5.htm#tagcjh_08_02_01_01" rel="nofollow">https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9696989899&#x2F;chap5.htm#t...</a><p>There are also “version 0” UUIDs that you are very unlikely to ever come across but should be noted because they are the source of the reserved bits (via wastefully setting aside an entire octet for Address Family) that later allowed the other “versions” to be specified in a compatible way. Read my research about them here in my UUID library: <a href="https:&#x2F;&#x2F;github.com&#x2F;okeeblow&#x2F;DistorteD&#x2F;blob&#x2F;NEW%E2%80%85SENSATION&#x2F;Globe%20Glitter&#x2F;lib&#x2F;globeglitter&#x2F;chrono_diver.rb#L61-L141">https:&#x2F;&#x2F;github.com&#x2F;okeeblow&#x2F;DistorteD&#x2F;blob&#x2F;NEW%E2%80%85SENSA...</a><p>I decided to support them Because It&#x27;s Cool™ but still need to figure out how to handle the date rollover of them and the even-older Apollo UIDs:<p><pre><code> irb&gt; ::GlobeGlitter::from_ncs_time =&gt; &quot;#&lt;GlobeGlitter 40639cd25341.02.00.00.e0.4c.18.00.69&gt;&quot; irb&gt; ::GlobeGlitter::from_ncs_time.to_time =&gt; 1988-12-21 14:52:02 UTC irb&gt; ::GlobeGlitter::from_aegis_time =&gt; &quot;#&lt;GlobeGlitter 00000000-0000-0000-4814-17c8b0080069&gt;&quot; </code></pre> (Proper AEGIS `#to_str` not implemented yet lol)
评论 #41451119 未加载
dlgeek9 months ago
&gt; UUID Version 2 (v2) is reserved for security IDs with no known details.<p>I found the details in about 2 minutes: Click the link in the article to take me to the section of RFC 9562 that says it&#x27;s defined as part of DCE, click the first link in that paragraph to go to the spec, ctrl-f &quot;UUID&quot;, then jump to appendix A (deceptively named &quot;Universal Unique Identifier&quot;) which has all the details.<p>Is it really too much to ask to CLICK YOUR OWN LINKS?
评论 #41354817 未加载
评论 #41351655 未加载
评论 #41351783 未加载
hamasho9 months ago
I wish there&#x27;s a standard for short UUID, like `73WakrfVbNJBaAmhQtEeDv` or `bK7nP9xM`. I mean, it&#x27;s not UUID cause it can be duplicated somewhere, I just want an ID standart combination of random and short enough to remember.
评论 #41351371 未加载
评论 #41351820 未加载
评论 #41351722 未加载
评论 #41352006 未加载
评论 #41451144 未加载
评论 #41352793 未加载
评论 #41352686 未加载
评论 #41351453 未加载
评论 #41351584 未加载
评论 #41351207 未加载
BohuTANG9 months ago
UUID v7&#x27;s timestamp is a game-changer for Databend. We&#x27;re using it to quickly locate metadata files on AWS S3 by timestamp, making operations like vacuuming much faster.<p>PR: <a href="https:&#x2F;&#x2F;github.com&#x2F;datafuselabs&#x2F;databend&#x2F;pull&#x2F;16049">https:&#x2F;&#x2F;github.com&#x2F;datafuselabs&#x2F;databend&#x2F;pull&#x2F;16049</a>
评论 #41354845 未加载
评论 #41354740 未加载
amarcheschi9 months ago
I&#x27;m failing at understanding what is the purpose of having uuid2. I didn&#x27;t even know that more type existed till now. I had only encountered uuid2 when asking xandr to remove my personal data from its database. (discussion about xandr being asked to be investigated in Europe by noyb here <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40913915">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40913915</a>)<p>By reading the Wikipedia page I&#x27;m failing at understanding why we invented something called universally unique identifier and have different types of it, some of which can be traced back to the original pc. Is it because mixing some Mac codes increase the chance of the uuid2 being randomic or does it have a different reason? For privacy reason, could we just not have a very long identifier with many different chars to choose from so that we have so many combinations that we&#x27;re almost guaranteed we&#x27;re using non duplicated uuids?
评论 #41352294 未加载
efilife9 months ago
Uuid 4 is just a random bytes generator that inserts hyphens in specified places. You don&#x27;t need to use it, you can just generate random bytes yourself and save on space (unnecessary hyphens, version info and so on)
评论 #41351823 未加载
评论 #41352162 未加载
评论 #41351785 未加载
Vecr9 months ago
I suggest not using any of the MAC based versions. In theory that could be anything other than v4 and v7, but v1 is the worst. As well as v3, MD5 is horribly broken.
评论 #41351261 未加载
motohagiography9 months ago
While I didn&#x27;t know the details of ones other than 4, the one really useful one missing would be using some SHA256 data with a counter, not unlike PBKDF2. It could be a privacy preserving derived identifier, where you you could loosely prove a given UUID had been derived from a given seed.
评论 #41354742 未加载
评论 #41352439 未加载
MrDarcy9 months ago
Just use v7.<p>Cue the security experts who say otherwise…
评论 #41350767 未加载
评论 #41350938 未加载
评论 #41351013 未加载
JSDevOps9 months ago
Interesting read. You learn something everyday.
pajeets9 months ago
is there something shorter than UUID<p>i hate how long it is<p>something like youtube URLs but guaranteed to be without duplicates
评论 #41351877 未加载
评论 #41352122 未加载
评论 #41353123 未加载
评论 #41351879 未加载
评论 #41353108 未加载
jagrsw9 months ago
Imagine how many careers have been built on inventing and promoting something, in the end, turned out to be a cleverly encoded output from &#x2F;dev&#x2F;urandom.
评论 #41354789 未加载
评论 #41352346 未加载
benreesman9 months ago
TLDR: UUIDv4 is one of several reasonable choices, but if it ends up mattering: you’re rich and famous and can do arbitrary fixes.<p>Not getting pwned by incrementing href attacks is good, past that, web scale bro.