{"id":13471457,"url":"https://github.com/lithammer/shortuuid","last_synced_at":"2025-05-12T11:16:58.559Z","repository":{"id":1769401,"uuid":"44492024","full_name":"lithammer/shortuuid","owner":"lithammer","description":"A generator library for concise, unambiguous and URL-safe UUIDs","archived":false,"fork":false,"pushed_at":"2025-04-01T16:42:40.000Z","size":210,"stargazers_count":1342,"open_issues_count":5,"forks_count":61,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-11T11:09:13.101Z","etag":null,"topics":["go","golang","shortuuid","uuid"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/lithammer/shortuuid/v4","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lithammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"lithammer"}},"created_at":"2015-10-18T19:07:46.000Z","updated_at":"2025-05-10T10:15:14.000Z","dependencies_parsed_at":"2023-07-05T20:17:18.701Z","dependency_job_id":"df437587-d427-41c3-b99a-5fa7c0b7104c","html_url":"https://github.com/lithammer/shortuuid","commit_stats":{"total_commits":97,"total_committers":12,"mean_commits":8.083333333333334,"dds":0.7216494845360825,"last_synced_commit":"f1aeca9366c5b97cb118e0f899bb27c64ecafe5a"},"previous_names":["renstrom/shortuuid"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithammer%2Fshortuuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithammer%2Fshortuuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithammer%2Fshortuuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithammer%2Fshortuuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lithammer","download_url":"https://codeload.github.com/lithammer/shortuuid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253554085,"owners_count":21926613,"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":["go","golang","shortuuid","uuid"],"created_at":"2024-07-31T16:00:45.242Z","updated_at":"2025-05-11T11:09:16.952Z","avatar_url":"https://github.com/lithammer.png","language":"Go","funding_links":["https://github.com/sponsors/lithammer"],"categories":["Go","Microservice","Repositories"],"sub_categories":[],"readme":"# shortuuid\n\n[![Build Status](https://github.com/lithammer/shortuuid/workflows/CI/badge.svg)](https://github.com/lithammer/shortuuid/actions)\n[![Godoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://pkg.go.dev/github.com/lithammer/shortuuid/v4)\n\nA Go library that generates concise, unambiguous, URL-safe UUIDs. Based on and\ncompatible with the Python library\n[`shortuuid`](https://github.com/skorokithakis/shortuuid).\n\nOften, one needs to use non-sequential IDs in places where users will see them,\nbut the IDs must be as concise and easy to use as possible. shortuuid solves\nthis problem by generating UUIDs using\n[google/uuid](https://github.com/google/uuid) and then translating them to\nbase57 using lowercase and uppercase letters and digits, and removing\nsimilar-looking characters such as l, 1, I, O and 0.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/lithammer/shortuuid/v4\"\n)\n\nfunc main() {\n\tu := shortuuid.New()\n\tfmt.Println(u) // KwSysDpxcBU9FNhGkn2dCf\n}\n```\n\nTo use UUID v5 (instead of the default v4), use `NewWithNamespace(name string)`\ninstead of `New()`.\n\n```go\nshortuuid.NewWithNamespace(\"http://example.com\")\n```\n\nIt's possible to use a custom alphabet as well (at least 2\ncharacters long).  \nIt will automatically sort and remove duplicates from your alphabet to ensure consistency\n\n```go\nalphabet := \"23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxy=\"\nshortuuid.NewWithAlphabet(alphabet) // iZsai==fWebXd5rLRWFB=u\n```\n\nBring your own encoder! For example, base58 is popular among bitcoin.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/btcsuite/btcutil/base58\"\n\t\"github.com/google/uuid\"\n\t\"github.com/lithammer/shortuuid/v4\"\n)\n\ntype base58Encoder struct{}\n\nfunc (enc base58Encoder) Encode(u uuid.UUID) string {\n\treturn base58.Encode(u[:])\n}\n\nfunc (enc base58Encoder) Decode(s string) (uuid.UUID, error) {\n\treturn uuid.FromBytes(base58.Decode(s))\n}\n\nfunc main() {\n\tenc := base58Encoder{}\n\tfmt.Println(shortuuid.NewWithEncoder(enc)) // 6R7VqaQHbzC1xwA5UueGe6\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithammer%2Fshortuuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flithammer%2Fshortuuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithammer%2Fshortuuid/lists"}