{"id":23289533,"url":"https://github.com/lh0x00/scuid","last_synced_at":"2026-02-12T08:06:31.329Z","repository":{"id":266860196,"uuid":"899578823","full_name":"lh0x00/scuid","owner":"lh0x00","description":"scuid is a lightweight Python library for generating compact, collision-resistant IDs optimized for scalability and performance. It offers a flexible alternative to cuid, supporting custom random number generators for tailored use cases.","archived":false,"fork":false,"pushed_at":"2025-01-27T08:23:39.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-12T08:55:52.402Z","etag":null,"topics":["collision-resistant","fingerprint","generative-ai","high-performance","horizontal-scaling","id-generator","identifier","ids-optimized","python","scuid","slug","unique-id","uuid"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/scuid","language":"Python","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/lh0x00.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-06T14:59:55.000Z","updated_at":"2025-01-27T08:23:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3b4332f-9ab7-40fc-bf57-cc36b2ec67ef","html_url":"https://github.com/lh0x00/scuid","commit_stats":null,"previous_names":["lh0x00/scuid"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/lh0x00/scuid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lh0x00%2Fscuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lh0x00%2Fscuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lh0x00%2Fscuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lh0x00%2Fscuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lh0x00","download_url":"https://codeload.github.com/lh0x00/scuid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lh0x00%2Fscuid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29361812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["collision-resistant","fingerprint","generative-ai","high-performance","horizontal-scaling","id-generator","identifier","ids-optimized","python","scuid","slug","unique-id","uuid"],"created_at":"2024-12-20T04:16:05.295Z","updated_at":"2026-02-12T08:06:31.324Z","avatar_url":"https://github.com/lh0x00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scuid\n\n[![PyPI](https://img.shields.io/pypi/v/scuid.svg?style=flat-square)](https://pypi.org/project/scuid/)\n[![License](https://img.shields.io/pypi/l/scuid.svg?style=flat-square)](https://pypi.org/project/scuid/)\n[![Downloads](https://img.shields.io/pypi/dm/scuid.svg?style=flat-square)](https://pypi.org/project/scuid/)\n\n**scuid** is a lightweight Python library for generating collision-resistant IDs optimized for horizontal scaling and high performance. It serves as a slim, alternative implementation of [cuid] with added flexibility for customization, including support for custom random number generators.\n\nWhether you're building distributed systems or need compact, unique identifiers, **scuid** offers a simple and efficient solution.\n\n[cuid]: https://github.com/ericelliott/cuid\n\n\u003e It is a reference port of the [scuid](https://github.com/jhermsmeier/node-scuid) source code for Node.js\n\n## Why Use scuid?\n\n- **Compact, Unique, and Efficient**: Generates small, collision-resistant IDs suitable for distributed systems. Compared to UUID v4, MD5, SHA1, and other collision-resistant ID generators, the shorter length of scuid IDs reduces the number of characters and tokens used. This makes scuid particularly advantageous for applications like generative AI, where minimizing token usage is often crucial.\n- **Customizable and Flexible**: Supports custom random number generators and configurable options, enabling tailored solutions for a wide range of use cases.\n- **Lightweight and High-Performance**: Designed to deliver fast ID generation without introducing unnecessary dependencies, ensuring optimal performance.\n\nFor more information or to contribute, visit the [GitHub repository](https://github.com/lh0x00/scuid).\n\n## Installation\n\nInstall **scuid** using [pip](https://pypi.org/project/scuid/):\n\n```sh\npip install scuid\n```\n\n## Quick Start\n\n### Generate a Unique ID\n\nCreate a unique identifier with just one line:\n\n```python\nfrom scuid import scuid\n\nid = scuid()\nprint(id)\n# Example output: 'ciux3hs0x0000io10cusdm8r2'\n```\n\n### Generate a Compact Slug\n\nSlugs are shorter representations suitable for use in URLs or filenames:\n\n```python\nfrom scuid import slug\n\nslug_value = slug()\nprint(slug_value)\n# Example output: '6x1i0r0'\n```\n\n### Get the Process Fingerprint\n\nThe fingerprint represents the process and machine where the ID was generated:\n\n```python\nfrom scuid import fingerprint\n\nfp = fingerprint()\nprint(fp)\n# Example output: 'io10'\n```\n\n## Advanced Usage\n\n### Customize the Random Number Generator (RNG)\n\nYou can provide a custom random number generator by implementing a `random()` method:\n\n```python\nfrom scuid import Scuid\n\nclass CustomRNG:\n    def random(self):\n        return 0.5  # Always returns 0.5 for demonstration purposes\n\ncustom_scuid = Scuid({\"rng\": CustomRNG().random})\nid = custom_scuid.id()\nprint(id)\n```\n\n### Configure Custom Options\n\nYou can customize the ID generation process to fit your requirements. Note that altering these options may affect compatibility with the default [cuid] behavior.\n\n```python\nfrom scuid import Scuid\n\ncustom_scuid = Scuid({\n    \"prefix\": \"c\",              # Prefix for generated IDs\n    \"base\": 36,                 # Radix for encoding (supports 2-36)\n    \"blockSize\": 4,             # Size of each padded block\n    \"fill\": \"0\",                # Padding character\n    \"pid\": 12345,               # Custom process ID\n    \"hostname\": \"customhost\",   # Custom hostname\n    \"rng\": lambda: 0.42,        # Custom RNG function\n})\n\nid = custom_scuid.id()\nprint(id)\n```\n\n## Testing\n\nTo verify the correctness and collision resistance of **scuid**, you can run the included tests:\n\n```sh\npytest\n```\n\nThe tests simulate real-world scenarios with millions of iterations to ensure the reliability of generated IDs.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flh0x00%2Fscuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flh0x00%2Fscuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flh0x00%2Fscuid/lists"}