Git Product home page Git Product logo

Comments (9)

vudaltsov avatar vudaltsov commented on July 23, 2024 1

I will do a PR.

from uuid.

vudaltsov avatar vudaltsov commented on July 23, 2024

Running same code with "ramsey/uuid": "4.5.1" does not give any collisions. So the bug is in new UnixTimeGenerator.

from uuid.

ramsey avatar ramsey commented on July 23, 2024

The new code in UnixTimeGenerator was mostly borrowed from symfony/uid. Can you reproduce the issue using their method for generating v7 UUIDs?

from uuid.

vudaltsov avatar vudaltsov commented on July 23, 2024

Can you reproduce the issue using their method for generating v7 UUIDs?

Yes, done.

from uuid.

nicolas-grekas avatar nicolas-grekas commented on July 23, 2024

See symfony/symfony#52367 for the fix

from uuid.

ramsey avatar ramsey commented on July 23, 2024

Thanks, @nicolas-grekas!

from uuid.

fannyfan414 avatar fannyfan414 commented on July 23, 2024

@ramsey @nicolas-grekas Hi! Have a question about uuid v7 collisions.

I need to replace 4-5 chars after generation uuid v7 with my specific characters (servers id or smth else).
At what positions would you advise me to change them so as not to greatly increase the chance of collisions?

from uuid.

vudaltsov avatar vudaltsov commented on July 23, 2024

@fannyfan414 , you can use UUID v8, it allows to put arbitrary content.

from uuid.

ramsey avatar ramsey commented on July 23, 2024

I would recommend using UUIDv8 for your use-case, by the way. It's intended for custom layouts like the one you're using.

To minimize chance of collision, I would probably place the server ID in the bytes to the far right of the UUID layout.

from uuid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.