{"id":16964384,"url":"https://github.com/bolorundurowb/shortid","last_synced_at":"2026-03-07T19:02:39.348Z","repository":{"id":21712684,"uuid":"93842019","full_name":"bolorundurowb/shortid","owner":"bolorundurowb","description":"A csharp library to generate short id's. they can be used as primary keys or unique identifiers","archived":false,"fork":false,"pushed_at":"2023-11-05T01:12:06.000Z","size":80,"stargazers_count":230,"open_issues_count":3,"forks_count":36,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-30T00:35:44.412Z","etag":null,"topics":["csharp","id-generation","shortid"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/bolorundurowb.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},"funding":{"patreon":"bolorundurowb"}},"created_at":"2017-06-09T09:23:22.000Z","updated_at":"2024-10-16T12:54:43.000Z","dependencies_parsed_at":"2024-06-18T12:38:34.111Z","dependency_job_id":null,"html_url":"https://github.com/bolorundurowb/shortid","commit_stats":{"total_commits":110,"total_committers":3,"mean_commits":"36.666666666666664","dds":0.0636363636363636,"last_synced_commit":"f859ecd25423fa3308233a2572adf1ab8d6a8fd2"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolorundurowb%2Fshortid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolorundurowb%2Fshortid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolorundurowb%2Fshortid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolorundurowb%2Fshortid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bolorundurowb","download_url":"https://codeload.github.com/bolorundurowb/shortid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518384,"owners_count":22084374,"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":["csharp","id-generation","shortid"],"created_at":"2024-10-13T23:43:27.065Z","updated_at":"2026-03-07T19:02:39.341Z","avatar_url":"https://github.com/bolorundurowb.png","language":"C#","funding_links":["https://patreon.com/bolorundurowb"],"categories":[],"sub_categories":[],"readme":"# ShortID 🆔\n\n[![Build, Test \u0026 Coverage](https://github.com/bolorundurowb/shortid/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/bolorundurowb/shortid/actions/workflows/build-and-test.yml) [![codecov](https://codecov.io/gh/bolorundurowb/shortid/graph/badge.svg?token=XBA3CK3YIS)](https://codecov.io/gh/bolorundurowb/shortid)  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)  ![NuGet Version](https://img.shields.io/nuget/v/shortid) \n\n\n**ShortId** is a lightweight and efficient C# library designed to generate completely random, short, and unique identifiers. These IDs are perfect for use as primary keys, unique identifiers, or any scenario where you need a compact, random string. 🎯\n\nWhat sets **ShortId** apart is its flexibility—you can specify the length of the IDs (between 8 and 15 characters) and customize the character set. It’s also **thread-safe**, making it ideal for high-performance applications that require generating millions of unique IDs across multiple threads. 💪\n\n\n## Getting Started 🚀\n\n### Installation 📦\n\nYou can add **ShortId** to your project using one of the following methods:\n\n#### **Package Manager**\n```cmd\nInstall-Package shortid\n```\n\n#### **.NET CLI**\n```bash\ndotnet add package shortid\n```\n\n#### **PackageReference**\n```xml\n\u003cPackageReference Include=\"shortid\" /\u003e\n```\n\n---\n\n## Usage 🛠️\n\n### Add the Namespace\nFirst, include the **ShortId** namespace in your code:\n```csharp\nusing shortid;\nusing shortid.Configuration;\n```\n\n### Generate a Random ID\nTo generate a random ID of default length (between 8 and 15 characters), simply call the `Generate` method:\n```csharp\nstring id = ShortId.Generate();\n// Example output: KXTR_VzGVUoOY\n```\n\n---\n\n### Customize ID Generation 🎨\n\n**ShortId** provides several options to tailor the generated IDs to your needs:\n\n#### **Include Numbers**\n```csharp\nvar options = new ShortIdOptions(useNumbers: true);\nstring id = ShortId.Generate(options);\n// Example output: O_bBY-YUkJg\n```\n\n#### **Exclude Special Characters**\n```csharp\nvar options = new ShortIdOptions(useSpecialCharacters: false);\nstring id = ShortId.Generate(options);\n// Example output: waBfk3z\n```\n\n#### **Specify ID Length**\n```csharp\nvar options = new ShortIdOptions(length: 9);\nstring id = ShortId.Generate(options);\n// Example output: M-snXzBkj\n```\n\n#### **Generate Sequential IDs**\nFor scenarios where you need IDs to be monotonic (i.e., each ID is greater than the previous one), you can enable sequential ID generation:\n```csharp\nvar options = new ShortIdOptions(generateSequential: true);\nstring id = ShortId.Generate(options);\n// Example output: 00000r_v\n```\nWhen this option is enabled, the first 6 characters of the ID represent a Base85 encoded timestamp, followed by random characters to complete the requested length.\n\n---\n\n## Customize ShortId 🎛️\n\n**ShortId** allows you to fully customize the character set and even seed the random number generator for reproducible results.\n\n### Change the Character Set\nYou can define your own character set for ID generation:\n```csharp\nstring characters = \"ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ①②③④⑤⑥⑦⑧⑨⑩⑪⑫\"; // Custom character set\nShortId.SetCharacters(characters);\n```\n\n**Note:**\n- The character set must contain at least **50 unique characters**.\n- Duplicate and whitespace characters are automatically removed.\n\n---\n\n### Set a Random Seed\nFor reproducible results, you can set a seed for the random number generator:\n```csharp\nint seed = 1939048828;\nShortId.SetSeed(seed);\n```\n\n---\n\n### Reset Customizations\nTo reset all customizations (character set, seed, etc.) to their defaults, use the `Reset` method:\n```csharp\nShortId.Reset();\n```\n\n---\n\n## Why Use ShortId? 🌟\n\n- **Flexible Length**: Generate IDs between 8 and 15 characters long.\n- **Customizable**: Use your own character set or exclude special characters.\n- **Thread-Safe**: Perfect for multi-threaded applications.\n- **Lightweight**: Minimal overhead, maximum performance.\n- **Easy to Use**: Simple API with just a few methods.\n\n---\n\n## License 📜\n\n**ShortId** is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n---\n\n## Get Started Today! 🎉\n\nWhether you need unique IDs for database keys, URLs, or any other purpose, **ShortId** has you covered. Install the package, follow the examples, and start generating unique IDs in seconds! ⏱️\n\n**Happy Coding!** 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolorundurowb%2Fshortid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbolorundurowb%2Fshortid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolorundurowb%2Fshortid/lists"}