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

Make uuid v4 rfc4122 compliant #580

Merged
merged 3 commits into from
Sep 11, 2019
Merged

Make uuid v4 rfc4122 compliant #580

merged 3 commits into from
Sep 11, 2019

Conversation

Mark1626
Copy link
Contributor

@Mark1626 Mark1626 commented Sep 3, 2019

UUID v4 is not currently RFC4122 compliant, the 8 is hard-coded

https://github.com/denoland/deno_std/blob/d36bff3fbe22a3585d23213e3f4c9f58756c032b/uuid/v4.ts#L13

Loosely based of https://github.com/google/uuid/blob/master/uuid.go

Went with the cleanest approach to convert Uint8Array to string, I could unwrap looping since the array contains 16 elements, if needed.
Let me know if any changes are required I'll make them.

Related to and fixes #559

@CLAassistant
Copy link

CLAassistant commented Sep 3, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I guess fewer calls to getRandomValues is better.

Tho I can't tell if there's any functional difference between the previous version...

@ry ry merged commit ba69f1e into denoland:master Sep 11, 2019
ry pushed a commit to ry/deno that referenced this pull request Oct 9, 2019
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

Successfully merging this pull request may close these issues.

UUID loses 2 bits of entropy
3 participants