{"id":13413521,"url":"https://github.com/teris-io/shortid","last_synced_at":"2026-01-20T12:02:17.188Z","repository":{"id":3288831,"uuid":"48967447","full_name":"teris-io/shortid","owner":"teris-io","description":"Super short, fully unique, non-sequential and URL friendly Ids","archived":false,"fork":false,"pushed_at":"2022-06-17T16:11:02.000Z","size":27,"stargazers_count":959,"open_issues_count":4,"forks_count":69,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-17T20:09:55.837Z","etag":null,"topics":["id","ids","shortid"],"latest_commit_sha":null,"homepage":"","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/teris-io.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":"2016-01-04T01:17:10.000Z","updated_at":"2025-12-15T11:44:05.000Z","dependencies_parsed_at":"2022-08-06T13:16:44.214Z","dependency_job_id":null,"html_url":"https://github.com/teris-io/shortid","commit_stats":null,"previous_names":["teris-io/go-shortid","ventu-io/go-shortid"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/teris-io/shortid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fshortid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fshortid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fshortid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fshortid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teris-io","download_url":"https://codeload.github.com/teris-io/shortid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fshortid/sbom","scorecard":{"id":874368,"data":{"date":"2025-08-11","repo":{"name":"github.com/teris-io/shortid","commit":"71ec9f2aa569ace076ca7ede55c4edae7a6a98c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 3/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T05:24:44.985Z","repository_id":3288831,"created_at":"2025-08-24T05:24:44.985Z","updated_at":"2025-08-24T05:24:44.985Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["id","ids","shortid"],"created_at":"2024-07-30T20:01:42.290Z","updated_at":"2026-01-20T12:02:17.158Z","avatar_url":"https://github.com/teris-io.png","language":"Go","funding_links":[],"categories":["杂项","Go","Miscellaneous","Uncategorized","其他","其他杂项","Microsoft Office","\u003cspan id=\"其他-miscellaneous\"\u003e其他 Miscellaneous\u003c/span\u003e"],"sub_categories":["未分类的","Uncategorized","Strings","交流","暂未分类这些库被放在这里是因为其他类别似乎都不适合。","Advanced Console UIs","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","暂未分类"],"readme":"[![Build status][buildimage]][build] [![Coverage][codecovimage]][codecov] [![GoReportCard][cardimage]][card] [![API documentation][docsimage]][docs]\n\n# Generator of unique non-sequential short Ids\n\nThe package `shortid`enables the generation of short, fully unique,\nnon-sequential and by default URL friendly Ids at a rate of hundreds of thousand per second. It\nguarantees uniqueness during the time period until 2050!\n\nThe package is heavily inspired by the node.js [shortid][nodeshortid] library (see more detail below).\n\nThe easiest way to start generating Ids is:\n\n\tfmt.Printf(shortid.Generate())\n\tfmt.Printf(shortid.Generate())\n\nThe recommended one is to initialise and reuse a generator specific to a given worker:\n\n\tsid, err := shortid.New(1, shortid.DefaultABC, 2342)\n\n\t// then either:\n\tfmt.Printf(sid.Generate())\n\tfmt.Printf(sid.Generate())\n\n\t// or:\n\tshortid.SetDefault(sid)\n\t// followed by:\n\tfmt.Printf(shortid.Generate())\n\tfmt.Printf(shortid.Generate())\n\n\n### Id Length\n\nThe standard Id length is 9 symbols when generated at a rate of 1 Id per millisecond,\noccasionally it reaches 11 (at the rate of a few thousand Ids per millisecond) and very-very\nrarely it can go beyond that during continuous generation at full throttle on high-performant\nhardware. A test generating 500k Ids at full throttle on conventional hardware generated the\nfollowing Ids at the head and the tail (length \u003e 9 is expected for this test):\n\n\t-NDveu-9Q\n\tiNove6iQ9J\n\tNVDve6-9Q\n\tVVDvc6i99J\n\tNVovc6-QQy\n\tVVoveui9QC\n\t...\n\ttFmGc6iQQs\n\tKpTvcui99k\n\tKFTGcuiQ9p\n\tKFmGeu-Q9O\n\ttFTvcu-QQt\n\ttpTveu-99u\n\n### Life span\n\nThe package guarantees the generation of unique Ids with no collisions for 34 years\n(1/1/2016-1/1/2050) using the same worker Id within a single (although can be concurrent)\napplication provided application restarts take longer than 1 millisecond. The package supports\nup to 32 workers all providing unique sequences from each other.\n\n### Implementation details\n\nAlthough heavily inspired by the node.js [shortid][nodeshortid] library this is\nnot just a Go port. This implementation\n\n* is safe to concurrency (test included);\n* does not require any yearly version/epoch resets (test included);\n* provides stable Id size over a the whole range of operation at the rate of 1ms (test included);\n* guarantees no collisions: due to guaranteed fixed size of Ids between milliseconds and because\nmultiple requests within the same ms lead to longer Ids with the prefix unique to the ms (tests\nincluded);\n* supports 32 instead of 16 workers (test included)\n\nThe algorithm uses less randomness than the original node.js implementation, which permits to extend\nthe life span as well as reduce and guarantee the length. In general terms, each Id has the\nfollowing 3 pieces of information encoded: the millisecond since epoch (first 8 symbols, epoch:\n1/1/2016), the worker Id (9th symbol), the running concurrent counter within the millisecond (only\nif required, spanning over all remaining symbols).\n\nThe element of randomness per symbol is 1/2 for the worker and the millisecond data and 0 for the\ncounter. The original algorithm of the node.js library uses 1/4 throughout. Here 0 means no\nrandomness, i.e. every value is encoded using a 64-base alphabet directly; 1/2 means one of two\nmatching symbols of the supplied alphabet is used randomly, 1/4 one of four matching symbols. All\nmethods accepting the parameters that govern the randomness are exported and can be used to directly\nimplement an algorithm with e.g. more randomness, but with longer Ids and shorter life spans.\n\n### License and copyright\n\n\tCopyright (c) 2016. Oleg Sklyar and teris.io. MIT license applies. All rights reserved.\n\n**[Original algorithm][nodeshortid]:** Copyright (c) 2015 Dylan Greene, contributors. The same MIT\nlicense applies. Many thanks to Dylan for putting together the original node.js library, which\ninspired this \"port\":\n\n**Seed computation:** based on The Central Randomizer 1.3. Copyright (c) 1997 Paul Houle (houle@msc.cornell.edu)\n\n[go]: https://golang.org\n[nodeshortid]: https://github.com/dylang/shortid\n\n[build]: https://travis-ci.org/teris-io/shortid\n[buildimage]: https://travis-ci.org/teris-io/shortid.svg?branch=master\n\n[codecov]: https://codecov.io/github/teris-io/shortid?branch=master\n[codecovimage]: https://codecov.io/github/teris-io/shortid/coverage.svg?branch=master\n\n[card]: http://goreportcard.com/report/teris-io/shortid\n[cardimage]: https://goreportcard.com/badge/github.com/teris-io/shortid\n\n[docs]: https://godoc.org/github.com/teris-io/shortid\n[docsimage]: http://img.shields.io/badge/godoc-reference-blue.svg?style=flat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteris-io%2Fshortid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteris-io%2Fshortid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteris-io%2Fshortid/lists"}