{"id":13509410,"url":"https://github.com/zyro/elixir-uuid","last_synced_at":"2025-05-15T03:03:15.725Z","repository":{"id":17724943,"uuid":"20554728","full_name":"zyro/elixir-uuid","owner":"zyro","description":"UUID generator and utilities for Elixir","archived":false,"fork":false,"pushed_at":"2024-07-26T09:01:41.000Z","size":92,"stargazers_count":364,"open_issues_count":22,"forks_count":83,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-15T03:03:02.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zyro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-06T07:14:19.000Z","updated_at":"2025-05-14T10:33:12.000Z","dependencies_parsed_at":"2024-11-05T23:02:57.576Z","dependency_job_id":"578c29e1-ca09-4fd3-8d69-e788401d1bdd","html_url":"https://github.com/zyro/elixir-uuid","commit_stats":{"total_commits":68,"total_committers":17,"mean_commits":4.0,"dds":0.3970588235294118,"last_synced_commit":"346581c7e89872e0e263e10f079e566cf1fc3a68"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyro%2Felixir-uuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyro%2Felixir-uuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyro%2Felixir-uuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyro%2Felixir-uuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zyro","download_url":"https://codeload.github.com/zyro/elixir-uuid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264744,"owners_count":22041792,"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":[],"created_at":"2024-08-01T02:01:07.355Z","updated_at":"2025-05-15T03:03:15.671Z","avatar_url":"https://github.com/zyro.png","language":"Elixir","funding_links":[],"categories":["Text and Numbers"],"sub_categories":[],"readme":"Elixir UUID\n===========\n\n[![hex.pm version](https://img.shields.io/hexpm/v/elixir_uuid.svg?style=flat)](https://hex.pm/packages/elixir_uuid)\n[![hex.pm downloads](https://img.shields.io/hexpm/dt/elixir_uuid.svg?style=flat)](https://hex.pm/packages/elixir_uuid)\n[![travis.ci build status](https://img.shields.io/travis/zyro/elixir-uuid.svg?style=flat)](https://travis-ci.org/zyro/elixir-uuid)\n\nUUID generator and utilities for [Elixir](http://elixir-lang.org/). See [RFC 4122](http://www.ietf.org/rfc/rfc4122.txt).\n\n**Note:** Renamed from [uuid](https://hex.pm/packages/uuid) to [elixir_uuid](https://hex.pm/packages/elixir_uuid) as a solution to package name conflicts. Use [elixir_uuid](https://hex.pm/packages/elixir_uuid) going forward.\n\n### Installation\n\nThe latest version is `1.2.0` and requires Elixir `~\u003e 1.0`. New releases may change this minimum compatible version depending on breaking language changes. The [changelog](https://github.com/zyro/elixir-uuid/blob/master/CHANGELOG.md) lists every available release and its corresponding language version requirement.\n\nReleases are published through [hex.pm](https://hex.pm/packages/elixir_uuid). Add as a dependency in your `mix.exs` file:\n```elixir\ndefp deps do\n  [ { :elixir_uuid, \"~\u003e 1.2\" } ]\nend\n```\n\n### UUID v1\n\nGenerated using a combination of time since the west adopted the gregorian calendar and the node id MAC address.\n\n```elixir\niex\u003e UUID.uuid1()\n\"5976423a-ee35-11e3-8569-14109ff1a304\"\n```\n\n### UUID v3\n\nGenerated using the MD5 hash of a name and either a namespace atom or an existing UUID. Valid namespaces are: `:dns`, `:url`, `:oid`, `:x500`, `:nil`.\n\n```elixir\niex\u003e UUID.uuid3(:dns, \"my.domain.com\")\n\"03bf0706-b7e9-33b8-aee5-c6142a816478\"\n\niex\u003e UUID.uuid3(\"5976423a-ee35-11e3-8569-14109ff1a304\", \"my.domain.com\")\n\"0609d667-944c-3c2d-9d09-18af5c58c8fb\"\n```\n\n### UUID v4\n\nGenerated based on pseudo-random bytes.\n\n```elixir\niex\u003e UUID.uuid4()\n\"fcfe5f21-8a08-4c9a-9f97-29d2fd6a27b9\"\n```\n\n### UUID v5\n\nGenerated using the SHA1 hash of a name and either a namespace atom or an existing UUID. Valid namespaces are: `:dns`, `:url`, `:oid`, `:x500`, `:nil`.\n\n```elixir\niex\u003e UUID.uuid5(:dns, \"my.domain.com\")\n\"016c25fd-70e0-56fe-9d1a-56e80fa20b82\"\n\niex\u003e UUID.uuid5(\"fcfe5f21-8a08-4c9a-9f97-29d2fd6a27b9\", \"my.domain.com\")\n\"b8e85535-761a-586f-9c04-0fb0df2cbe84\"\n```\n\n### Formatting\n\nAll UUID generator functions have an optional format parameter as the last argument.\n\nPossible values: `:default`, `:hex`, `:urn`. Default value is `:default` and can be omitted.\n\n`:default` is a standard UUID representation:\n```elixir\niex\u003e UUID.uuid1()\n\"3c69679f-774b-4fb1-80c1-7b29c6e7d0a0\"\n\niex\u003e UUID.uuid4(:default)\n\"3c69679f-774b-4fb1-80c1-7b29c6e7d0a0\"\n\niex\u003e UUID.uuid3(:dns, \"my.domain.com\")\n\"03bf0706-b7e9-33b8-aee5-c6142a816478\"\n\niex\u003e UUID.uuid5(:dns, \"my.domain.com\", :default)\n\"016c25fd-70e0-56fe-9d1a-56e80fa20b82\"\n```\n\n`:hex` is a valid hex string, corresponding to the standard UUID without the `-` (dash) characters:\n```elixir\niex\u003e UUID.uuid4(:hex)\n\"19be859d0c1f4a7f95ddced995037350\"\n\niex\u003e UUID.uuid4(:weak, :hex)\n\"ebeff765ddc843e486c287fb668d5d37\"\n```\n\n`:urn` is a standard UUID representation prefixed with the UUID URN:\n```elixir\niex\u003e UUID.uuid1(:urn)\n\"urn:uuid:b7483bde-ee35-11e3-8daa-14109ff1a304\"\n```\n\n### Utility functions\n\nUse `UUID.info/1` and `UUID.info!/1` to get a [keyword list](http://elixir-lang.org/getting_started/7.html#toc_1) containing information about the given UUID. `UUID.info/1` returns a tuple of `{:ok, info}` for valid cases or `{:error, reason}` if the argument is not a UUID string. `UUID.info!/1` directly returns the info keyword list when successful or raises an `ArgumentError` for error cases.\n```elixir\niex\u003e UUID.info!(\"870df8e8-3107-4487-8316-81e089b8c2cf\")\n[uuid: \"870df8e8-3107-4487-8316-81e089b8c2cf\",\n binary: \u003c\u003c135, 13, 248, 232, 49, 7, 68, 135, 131, 22, 129, 224, 137, 184, 194, 207\u003e\u003e,\n type: :default,\n version: 4,\n variant: :rfc4122]\n\niex\u003e UUID.info!(\"8ea1513df8a14dea9bea6b8f4b5b6e73\")\n[uuid: \"8ea1513df8a14dea9bea6b8f4b5b6e73\",\n binary: \u003c\u003c142, 161, 81, 61, 248, 161, 77, 234, 155, 234, 107, 143, 75, 91, 110, 115\u003e\u003e,\n type: :hex,\n version: 4,\n variant: :rfc4122]\n\niex\u003e UUID.info!(\"urn:uuid:ef1b1a28-ee34-11e3-8813-14109ff1a304\")\n[uuid: \"urn:uuid:ef1b1a28-ee34-11e3-8813-14109ff1a304\",\n binary: \u003c\u003c239, 27, 26, 40, 238, 52, 17, 227, 136, 19, 20, 16, 159, 241, 163, 4\u003e\u003e,\n type: :urn,\n version: 1,\n variant: :rfc4122]\n```\n\nUse `UUID.string_to_binary!/1` to convert a valid UUID string to its raw binary equivalent. An `ArgumentError` is raised if the argument is not a valid UUID string.\n```elixir\niex\u003e UUID.string_to_binary!(\"870df8e8-3107-4487-8316-81e089b8c2cf\")\n\u003c\u003c135, 13, 248, 232, 49, 7, 68, 135, 131,\n            22, 129, 224, 137, 184, 194, 207\u003e\u003e\n\niex\u003e UUID.string_to_binary!(\"8ea1513df8a14dea9bea6b8f4b5b6e73\")\n\u003c\u003c142, 161, 81, 61, 248, 161, 77, 234, 155,\n            234, 107, 143, 75, 91, 110, 115\u003e\u003e\n\n\niex\u003e UUID.string_to_binary!(\"urn:uuid:ef1b1a28-ee34-11e3-8813-14109ff1a304\")\n\u003c\u003c239, 27, 26, 40, 238, 52, 17, 227, 136,\n            19, 20, 16, 159, 241, 163, 4\u003e\u003e\n```\n\nUse `UUID.binary_to_string!/2` to convert valid UUID binary data to a String representation, with an optional format similar to the generator functions above. An `ArgumentError` is raised if the argument is not valid UUID binary data.\n```elixir\niex\u003e UUID.binary_to_string!(\u003c\u003c135, 13, 248, 232, 49, 7, 68, 135, 131,\n            22, 129, 224, 137, 184, 194, 207\u003e\u003e)\n\"870df8e8-3107-4487-8316-81e089b8c2cf\"\n\niex\u003e UUID.binary_to_string!(\u003c\u003c142, 161, 81, 61, 248, 161, 77, 234, 155,\n            234, 107, 143, 75, 91, 110, 115\u003e\u003e, :hex)\n\"8ea1513df8a14dea9bea6b8f4b5b6e73\"\n\niex\u003e UUID.binary_to_string!(\u003c\u003c239, 27, 26, 40, 238, 52, 17, 227, 136,\n            19, 20, 16, 159, 241, 163, 4\u003e\u003e, :urn)\n\"urn:uuid:ef1b1a28-ee34-11e3-8813-14109ff1a304\"\n```\n\n### Attribution\n\nSome code ported from [avtobiff/erlang-uuid](https://github.com/avtobiff/erlang-uuid).\n\nSome helper functions from [rjsamson/hexate](https://github.com/rjsamson/hexate).\n\n### License\n\n```\nCopyright 2014-2016 Andrei Mihu\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyro%2Felixir-uuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzyro%2Felixir-uuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyro%2Felixir-uuid/lists"}