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

RFC-4122 doesn't specify UUID v3 and v5 without a namespace #35

Open
OSA413 opened this issue Jul 14, 2024 · 1 comment
Open

RFC-4122 doesn't specify UUID v3 and v5 without a namespace #35

OSA413 opened this issue Jul 14, 2024 · 1 comment

Comments

@OSA413
Copy link

OSA413 commented Jul 14, 2024

I've just found out that the generation of UUIDs without a namespace are not standard, all other implementations found online and in other programming languages requires providing a namespace and a name.

The specification explicitly says to use a namespace during generation:

"o  Compute the hash of the name space ID concatenated with the name."

Currently your library concatenates an empty array that results in using just the data of the provided name for hashing without any data of the namespace: https://github.com/danakt/uuid-by-string/blob/master/src/index.js#L35

Should you specify in the documentation about library's non-standard function?

Another solution would be using a nil UUID as namespace in cases when user provides no namespace (but that will break current tests that check the generation of UUID without a namespace).

@OSA413
Copy link
Author

OSA413 commented Jul 23, 2024

The fix turned out to be easy, I actually think that it was a bug because it actually needed to be 16, not 0:

https://github.com/danakt/uuid-by-string/blob/master/src/index.js#L4

Anyway, here's the PR: #36

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

1 participant