Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed UUIDs v4 #17

Open
bennycode opened this issue Jun 19, 2020 · 3 comments
Open

Malformed UUIDs v4 #17

bennycode opened this issue Jun 19, 2020 · 3 comments

Comments

@bennycode
Copy link
Contributor

I have been using new UUID(4).format() and noticed that it generates some invalid / malformed UUIDs.

A proper UUID v4 looks like this:

  • b277311c-dd9c-45c1-a041-2f78c5fd066e (32 chars total, 4 dashes)

But I somehow received the following UUIDs:

  • 298f8a6b-3e-1c4-4bba-9488-8f4b233e63e7 (34 chars total, 5 dashes)
  • 15ee-168da--20c6-4c1f0-9a2b--2806bf323e706 (36 chars total, 6 dashes)

Is it possible that UUID(4).format() generates UUIDs with too many dashes (with 1 extra char per extra dash)? Can this library be affected by a sign problem?

@rse
Copy link
Owner

rse commented Jun 19, 2020

I cannot reproduce your problem:

$ cat test.js 
const UUID = require("./")
for (let i = 0; i < 100000; i++)
     console.log(new UUID(4).format())
$ node test.js | egrep -v '^.{36}$' 

Even with 100K generated UUIDs it was always 36 characters in total...

@Yserz
Copy link

Yserz commented Jun 25, 2020

We replaced the library without other changes and the issue went away.

@bennycode
Copy link
Contributor Author

@rse we experienced the described problem only with some users but reliably. Is it possible that your algorithm uses system specific values for its computation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants