GithubHelp home page GithubHelp logo

Comments (3)

homanchou avatar homanchou commented on June 16, 2024

As a work around for now, specifying the uuid string of the namespace does in fact work:

iex> UUID.uuid5("6ba7b812-9dad-11d1-80b4-00c04fd430c8", "hi.bye")
"e1cd0925-0852-5171-9e44-5fce3d17ee7d"

Here is a list of uid namespaces:

http://stackoverflow.com/questions/10867405/generating-v5-uuid-what-is-name-and-namespace

The UUID RFC pre-defines four namespaces for you:

NameSpace_DNS: {6ba7b810-9dad-11d1-80b4-00c04fd430c8}
NameSpace_URL: {6ba7b811-9dad-11d1-80b4-00c04fd430c8}
NameSpace_OID: {6ba7b812-9dad-11d1-80b4-00c04fd430c8}
NameSpace_X500:{6ba7b814-9dad-11d1-80b4-00c04fd430c8}

Using the atoms does not work, it looks like the issue might be in this line
https://github.com/zyro/elixir-uuid/blob/master/lib/uuid.ex#L330

Might be the wrong type of encoding compared to erlang version? https://github.com/avtobiff/erlang-uuid/blob/master/src/uuid.erl#L193

The nil namespace works, since it's all zeros. https://github.com/zyro/elixir-uuid/blob/master/lib/uuid.ex#L337

from elixir-uuid.

zyro avatar zyro commented on June 16, 2024

You're right, looks like it was a binary encoding issue. Thanks for the thorough investigation!

I've released an updated version: https://hex.pm/packages/uuid/1.1.6

Closed by #27.

from elixir-uuid.

homanchou avatar homanchou commented on June 16, 2024

cool! Thanks for merging. I assume you're going to update the readme too? I think the uuid3 and uuid5 examples on it might be wrong too.

from elixir-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.