{"id":15059693,"url":"https://github.com/tsfoster/elm-uuid","last_synced_at":"2025-06-14T22:02:45.063Z","repository":{"id":42008568,"uuid":"147543829","full_name":"TSFoster/elm-uuid","owner":"TSFoster","description":"UUIDs in Elm","archived":false,"fork":false,"pushed_at":"2022-04-19T08:28:24.000Z","size":157,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T06:54:38.163Z","etag":null,"topics":["elm","elm-lang","uuid","uuid-generator","uuid3","uuid4"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/TSFoster/elm-uuid/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TSFoster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-05T15:56:33.000Z","updated_at":"2025-02-18T22:27:34.000Z","dependencies_parsed_at":"2022-08-12T02:10:58.945Z","dependency_job_id":null,"html_url":"https://github.com/TSFoster/elm-uuid","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-uuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-uuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-uuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-uuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TSFoster","download_url":"https://codeload.github.com/TSFoster/elm-uuid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166221,"owners_count":21058475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","elm-lang","uuid","uuid-generator","uuid3","uuid4"],"created_at":"2024-09-24T22:46:43.369Z","updated_at":"2025-04-10T05:41:27.369Z","avatar_url":"https://github.com/TSFoster.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm UUID\n\nA universally unique identifier, or [UUID], is a 128-bit number,\nusually represented as 32 hexidecimal digits, in the format\n`123e4567-e89b-42d3-a456-426655440000`. This package provides a UUID type, and\nfunctions for reading, creating, randomly generating, inspecting and formatting\nUUIDs.\n\nThere are several versions and variants of UUID. This package supports\nthe reading of all variant 1 UUIDs (versions 1-5, those outlined in [RFC\n4122][rfc]), and the creation of versions 3, 4 and 5. This covers the vast\nmajority of UUIDs in use today.\n\n\n## Examples\n\n```elm\nimport UUID exposing (UUID)\nimport Random\n\n\nRandom.initialSeed 12345\n    |\u003e Random.step (Random.list 3 UUID.generator)\n    |\u003e Tuple.first\n    |\u003e List.map UUID.toString\n--\u003e [ \"88c973e3-f83f-4360-a320-d8844c365130\"\n--\u003e , \"78bc3402-e662-4d59-bac5-914be6425299\"\n--\u003e , \"5b58931d-bb69-406d-81a9-7746c300838c\"\n--\u003e ]\n\n\nappID : UUID\nappID = UUID.forName \"myapplication.com\" UUID.dnsNamespace\n\nUUID.toString appID\n--\u003e \"2ed74b2b-10eb-5b44-93be-69aa8952caac\"\n```\n\n## Roadmap\n\n* More tests:\n  * test fromBytes explicitly\n  * fewer/simpler doc tests?\n  * test against set of known v3/v5 UUIDs\n  * split into smaller files?\n\n\n## Q\u0026A\n\n### Are the generated UUIDs random enough?\n\nShort answer: for most cases where you want to quickly generate a UUID on the\nclient, probably.\n\n`Random.Seed` has either 32 or 54 bits of randomness, depending on your system\nVersion 4 UUIDs should have 122 bits of randomness. You should consider [how\nbest to generate your Seed][elmrandom2]. Although the API is a little messier\nthan using `UUID.Generator`, it is recommended to try using `UUID.step`, so\n`UUID`s can be generated using four independent seeds. One way of generating the\nseeds would be to use [`Crypto.getRandomValues()`][getRandomValues] to create\nfour 32-bit integers, and passing them in as flags or via ports.\n\n### Which version UUID am I using?\n\nYou can check what variant/version you are using by looking at one of the\nUUIDs, which should be in the format `00000000-0000-A000-B000-000000000000`.\nIf the character at position `B` is `8`, `9`, `a` or `b`, you have a variant 1\nUUID, and this package is for you! The character in position `A` is the version\nnumber. (If it isn't `1`, `2`, `3`, `4` or `5`, then it isn't a UUID as defined\nby the [RFC][rfc].)\n\n### Which version UUID should I use?\n\nProbably either version 4 or 5, depending on your use case. Version 4 UUIDs\nare randomly generated, while version 5 UUIDs are created from a \"name\" and\na \"namespace\", such that the same \"name\" and \"namespace\" produces the same\nUUID.\n\nIf you want to use the UUID as a key for a value that may change over\ntime, you may want to use [`generator`][generator] to create version 4 UUIDs.\n\nIf the UUID will refer to something that will not change over time, or will\nneed to be calculated in some other way from some input data, consider using\n[`forName`][forName] and [`forBytes`][forBytes] to create version 5 UUIDs\n(version 3 UUIDs are very similar, but version 5 is recommended unless required\nfor backwards-compatbility).\n\n### I have a suggestion/I've found a bug\n\nPlease [open an issue on Github][new-issue] and I'll get back to you as soon as\nI can.\n\n### I need to create version 1/2 UUIDs\n\nThis can't *reaallly* be done in the browser (as far as I know), but feel free\nto [open an issue on Github][new-issue] anyway.\n\n### I need variant 0 UUIDs!\n\nReally!? Umm, well I guess you'd better [open an issue on Github][new-issue].\n\n### I need variant 1 UUIDs!\n\nThis might be better suited in a separate package, but why not [open an issue on\nGithub][new-issue]?\n\n\n[UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier\n[new-issue]: https://github.com/TSFoster/elm-uuid/issues/new\n[elmrandom2]: https://github.com/elm/random/issues/2\n[getRandomValues]: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\n[rfc]: https://tools.ietf.org/html/rfc4122\n[generator]: https://package.elm-lang.org/packages/TSFoster/elm-uuid/latest/UUID#generator\n[forName]: https://package.elm-lang.org/packages/TSFoster/elm-uuid/latest/UUID#forName\n[forBytes]: https://package.elm-lang.org/packages/TSFoster/elm-uuid/latest/UUID#forBytes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-uuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsfoster%2Felm-uuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-uuid/lists"}