Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. UUIDs are so funny today because almost all of their deployments is "we take a string of mostly-random bits but give it structure for no apparent reason"

UUIDs are so funny today because almost all of their deployments is "we take a string of mostly-random bits but give it structure for no apparent reason"

Scheduled Pinned Locked Moved Uncategorized
22 Posts 12 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

    it's true that you could populate some of those bits with predictable sequences to avoid clashing (a la snowflake) but guess what: you can do this to a hex string or a number (as does snowflake). i think the only reason UUIDs are as popular as they are today is Microsoft?

    casandro@f-ckendehoelle.deC This user is from outside of this forum
    casandro@f-ckendehoelle.deC This user is from outside of this forum
    casandro@f-ckendehoelle.de
    wrote last edited by
    #8

    @whitequark What makes this stranger is that there's a lot of software around that uses external dependencies to create UUIDs to act as random strings... even when the enthropy to character ratio would be important. After all rolling your own routine is trivial and fast... and allows you to cram in 6.5 bits per character easily.

    whitequark@social.treehouse.systemsW 1 Reply Last reply
    0
    • dysfun@social.treehouse.systemsD dysfun@social.treehouse.systems

      @whitequark java stuff likes them as well, that probably didn't hurt.

      what really upsets me though is your randomness library doesn't actually support a bit at a time because that would be silly, so of course you just grab 128 bits and then drop 4 on the floor and waste them.

      it's a silly thing, but when you're making it worse in the process...

      whitequark@social.treehouse.systemsW This user is from outside of this forum
      whitequark@social.treehouse.systemsW This user is from outside of this forum
      whitequark@social.treehouse.systems
      wrote last edited by
      #9

      @dysfun i don't think 124 vs 128 bits of randomness makes any salient difference

      dysfun@social.treehouse.systemsD 1 Reply Last reply
      0
      • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

        @dysfun i don't think 124 vs 128 bits of randomness makes any salient difference

        dysfun@social.treehouse.systemsD This user is from outside of this forum
        dysfun@social.treehouse.systemsD This user is from outside of this forum
        dysfun@social.treehouse.systems
        wrote last edited by
        #10

        @whitequark no, it doesn't. but you've already generated them then you just throw them away because they've arbitrarily decided to mark some of them with a constant.

        1 Reply Last reply
        0
        • casandro@f-ckendehoelle.deC casandro@f-ckendehoelle.de

          @whitequark What makes this stranger is that there's a lot of software around that uses external dependencies to create UUIDs to act as random strings... even when the enthropy to character ratio would be important. After all rolling your own routine is trivial and fast... and allows you to cram in 6.5 bits per character easily.

          whitequark@social.treehouse.systemsW This user is from outside of this forum
          whitequark@social.treehouse.systemsW This user is from outside of this forum
          whitequark@social.treehouse.systems
          wrote last edited by
          #11

          @casandro 124 bits of randomness is enough for basically any application where UUIDs are used as references

          casandro@f-ckendehoelle.deC 1 Reply Last reply
          0
          • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

            it's true that you could populate some of those bits with predictable sequences to avoid clashing (a la snowflake) but guess what: you can do this to a hex string or a number (as does snowflake). i think the only reason UUIDs are as popular as they are today is Microsoft?

            nyovaya@transfem.socialN This user is from outside of this forum
            nyovaya@transfem.socialN This user is from outside of this forum
            nyovaya@transfem.social
            wrote last edited by
            #12

            @whitequark@social.treehouse.systems I thought Microsoft made GUIDs popular?

            whitequark@social.treehouse.systemsW 1 Reply Last reply
            0
            • nyovaya@transfem.socialN nyovaya@transfem.social

              @whitequark@social.treehouse.systems I thought Microsoft made GUIDs popular?

              whitequark@social.treehouse.systemsW This user is from outside of this forum
              whitequark@social.treehouse.systemsW This user is from outside of this forum
              whitequark@social.treehouse.systems
              wrote last edited by
              #13

              @nyovaya they are the same thing

              1 Reply Last reply
              0
              • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                UUIDs are so funny today because almost all of their deployments is "we take a string of mostly-random bits but give it structure for no apparent reason"

                wrosecrans@mstdn.socialW This user is from outside of this forum
                wrosecrans@mstdn.socialW This user is from outside of this forum
                wrosecrans@mstdn.social
                wrote last edited by
                #14

                @whitequark Once constructed, I have literally never seen anybody ever care about the specific fields. There's no reason for it to be divided up asymmetrically because the only things people do with those sorts of uids is bit compare the whole thing, or print as text in hex.

                1 Reply Last reply
                0
                • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                  @casandro 124 bits of randomness is enough for basically any application where UUIDs are used as references

                  casandro@f-ckendehoelle.deC This user is from outside of this forum
                  casandro@f-ckendehoelle.deC This user is from outside of this forum
                  casandro@f-ckendehoelle.de
                  wrote last edited by
                  #15

                  @whitequark Yes, but it takes a lot of characters. Particulary in protocols like SIP where you don't want to spend a lot of bytes for your message (you don't want fragementation), having a SIP-stack that just puts in UUIDs can really cause problems. Plus for SIP you want a variable number of randomness for different parts. While you might want 64 bits for your Call-ID, the From:- and To:-Tags are fine with 16 bits.
                  Again, every byte saved in the header saves you from problems.

                  1 Reply Last reply
                  0
                  • dysfun@social.treehouse.systemsD dysfun@social.treehouse.systems

                    @whitequark actually i remember microsoft more for GUIDs than UUIDs

                    ramsey@phpc.socialR This user is from outside of this forum
                    ramsey@phpc.socialR This user is from outside of this forum
                    ramsey@phpc.social
                    wrote last edited by
                    #16

                    @dysfun @whitequark GUIDs and UUIDs are the same, except for the order of the bytes in binary form. For UUIDs, all bytes are in network byte order (big-endian). In a GUID, the order of the bytes are reversed in each grouping for the first 64 bits and stored in little-endian order. The remaining 64 bits are stored in network byte order. Both string representations are the same. Who knows why. 🤷‍♂️

                    1 Reply Last reply
                    0
                    • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                      it's true that you could populate some of those bits with predictable sequences to avoid clashing (a la snowflake) but guess what: you can do this to a hex string or a number (as does snowflake). i think the only reason UUIDs are as popular as they are today is Microsoft?

                      ramsey@phpc.socialR This user is from outside of this forum
                      ramsey@phpc.socialR This user is from outside of this forum
                      ramsey@phpc.social
                      wrote last edited by
                      #17

                      @whitequark Most applications that use UUIDs these days tend to use version 7 UUIDs, which use milliseconds since the Unix epoch as the most significant bits. This embeds the creation timestamp in the ID and allows for sorting, while also adding in sufficient randomness so they're not incremental and multiple systems can generate them with low probability of collision.

                      whitequark@social.treehouse.systemsW saikou@gts.chuuni.solutionsS 2 Replies Last reply
                      0
                      • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                        UUIDs are so funny today because almost all of their deployments is "we take a string of mostly-random bits but give it structure for no apparent reason"

                        slatian@pleroma.envs.netS This user is from outside of this forum
                        slatian@pleroma.envs.netS This user is from outside of this forum
                        slatian@pleroma.envs.net
                        wrote last edited by
                        #18

                        @whitequark@treehouse.systems The "structure" makes them easier to handle for human brains and they are an RFC that is implemented in a lot of places.

                        I'd say they've gotten developer experience right by accident.

                        1 Reply Last reply
                        0
                        • ramsey@phpc.socialR ramsey@phpc.social

                          @whitequark Most applications that use UUIDs these days tend to use version 7 UUIDs, which use milliseconds since the Unix epoch as the most significant bits. This embeds the creation timestamp in the ID and allows for sorting, while also adding in sufficient randomness so they're not incremental and multiple systems can generate them with low probability of collision.

                          whitequark@social.treehouse.systemsW This user is from outside of this forum
                          whitequark@social.treehouse.systemsW This user is from outside of this forum
                          whitequark@social.treehouse.systems
                          wrote last edited by
                          #19

                          @ramsey oh, I didn't know this!

                          azonenberg@ioc.exchangeA 1 Reply Last reply
                          0
                          • ramsey@phpc.socialR ramsey@phpc.social

                            @whitequark Most applications that use UUIDs these days tend to use version 7 UUIDs, which use milliseconds since the Unix epoch as the most significant bits. This embeds the creation timestamp in the ID and allows for sorting, while also adding in sufficient randomness so they're not incremental and multiple systems can generate them with low probability of collision.

                            saikou@gts.chuuni.solutionsS This user is from outside of this forum
                            saikou@gts.chuuni.solutionsS This user is from outside of this forum
                            saikou@gts.chuuni.solutions
                            wrote last edited by
                            #20

                            @ramsey @whitequark yeah, at a previous job we used v7 uuids with for request IDs with a single-character signifying the source of the request and a freeform suffix (guaranteed to be delimited by a non-\w character for ease of splitting).

                            1 Reply Last reply
                            0
                            • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                              it's true that you could populate some of those bits with predictable sequences to avoid clashing (a la snowflake) but guess what: you can do this to a hex string or a number (as does snowflake). i think the only reason UUIDs are as popular as they are today is Microsoft?

                              ratsnakegames@mastodon.socialR This user is from outside of this forum
                              ratsnakegames@mastodon.socialR This user is from outside of this forum
                              ratsnakegames@mastodon.social
                              wrote last edited by
                              #21

                              @whitequark i like UUIDs because someone else has already solved the problem of "how to make thing unique" for me and i don't have to think about it

                              1 Reply Last reply
                              0
                              • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                                @ramsey oh, I didn't know this!

                                azonenberg@ioc.exchangeA This user is from outside of this forum
                                azonenberg@ioc.exchangeA This user is from outside of this forum
                                azonenberg@ioc.exchange
                                wrote last edited by
                                #22

                                @whitequark @ramsey I've only ever seen version 4 (unstructured random) in production that i can recall

                                1 Reply Last reply
                                1
                                0
                                • R relay@relay.infosec.exchange shared this topic
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups