{"id":33239450,"url":"https://github.com/sqids/sqids-ocaml","last_synced_at":"2025-12-30T04:30:17.826Z","repository":{"id":176746982,"uuid":"658043176","full_name":"sqids/sqids-ocaml","owner":"sqids","description":"Official OCaml port of Sqids. Generate short unique IDs from numbers.","archived":false,"fork":false,"pushed_at":"2024-02-10T18:05:54.000Z","size":548,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-28T12:34:28.929Z","etag":null,"topics":["hashids","id","id-generator","ocaml","short","short-id","sqids","uid","unique-id","unique-id-generator"],"latest_commit_sha":null,"homepage":"https://sqids.org/ocaml","language":"OCaml","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/sqids.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}},"created_at":"2023-06-24T15:33:11.000Z","updated_at":"2024-05-10T04:53:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc0663e7-d084-4ee9-8ae9-d062946038d8","html_url":"https://github.com/sqids/sqids-ocaml","commit_stats":null,"previous_names":["sqids/sqids-ocaml"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sqids/sqids-ocaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-ocaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-ocaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-ocaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-ocaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqids","download_url":"https://codeload.github.com/sqids/sqids-ocaml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-ocaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"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","status":"online","status_checked_at":"2025-11-26T02:00:06.075Z","response_time":193,"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":["hashids","id","id-generator","ocaml","short","short-id","sqids","uid","unique-id","unique-id-generator"],"created_at":"2025-11-16T19:00:41.515Z","updated_at":"2025-11-26T09:00:52.712Z","avatar_url":"https://github.com/sqids.png","language":"OCaml","funding_links":[],"categories":["Utilities"],"sub_categories":[],"readme":"# [Sqids OCaml](https://sqids.org/ocaml)\n\n[![OCaml-CI Build Status](https://img.shields.io/endpoint?url=https://ocaml.ci.dev/badge/sqids/sqids-ocaml/main\u0026logo=ocaml)](https://ocaml.ci.dev/github/sqids/sqids-ocaml)\n\n[Sqids](https://sqids.org/ocaml) (*pronounced \"squids\"*) is a small library that lets you **generate unique IDs from numbers**. It's good for link shortening, fast \u0026 URL-safe ID generation and decoding back into numbers for quicker database lookups.\n\nFeatures:\n\n- **Encode multiple numbers** - generate short IDs from one or several non-negative numbers\n- **Quick decoding** - easily decode IDs back into numbers\n- **Unique IDs** - generate unique IDs by shuffling the alphabet once\n- **ID padding** - provide minimum length to make IDs more uniform\n- **URL safe** - auto-generated IDs do not contain common profanity\n- **Randomized output** - Sequential input provides nonconsecutive IDs\n- **Many implementations** - Support for [40+ programming languages](https://sqids.org/)\n\n## 🧰 Use-cases\n\nGood for:\n\n- Generating IDs for public URLs (eg: link shortening)\n- Generating IDs for internal systems (eg: event tracking)\n- Decoding for quicker database lookups (eg: by primary keys)\n\nNot good for:\n\n- Sensitive data (this is not an encryption library)\n- User IDs (can be decoded revealing user count)\n\n## 🚀 Getting started\n\nInstall:\n\n```shell\nopam install sqids\n```\n\nAdd to `dune-project`:\n\n```text\n(sqids (= 0.1.0))\n```\n\nAdd to `dune` for your target:\n\n```text\n(libraries sqids)\n```\n\nTry in `utop`:\n\n```ocaml\n# require \"sqids\";;\nlet s = Sqids.make () in\nSqids.encode s [1; 2; 3]\n```\n\n## 👩‍💻 Examples\n\nSimple encode \u0026 decode:\n\n\u003e **Note**\n\u003e 🚧 Because of the algorithm's design, **multiple IDs can decode back into the same sequence of numbers**. If it's important to your design that IDs are canonical, you have to manually re-encode decoded numbers and check that the generated ID matches.\n\nEnforce a *minimum* length for IDs:\n\n```ocaml\nlet sqids = Sqids.make ~min_length:10 () in\nlet id = Sqids.encode sqids [1; 2; 3] in (* \"86Rf07xd4z\" *)\nlet numbers = Sqids.decode sqids id in (* [1; 2; 3] *)\n```\n\nRandomize IDs by providing a custom alphabet:\n\n```ocaml\nlet sqids = Sqids.make ~alphabet:\"FxnXM1kBN6cuhsAvjW3Co7l2RePyY8DwaU04Tzt9fHQrqSVKdpimLGIJOgb5ZE\" () in\nlet id = Sqids.encode sqids [1; 2; 3] in (* \"B4aajs\" *)\nlet numbers = Sqids.decode sqids id in (* [1; 2; 3] *)\n```\n\nPrevent specific words from appearing anywhere in the auto-generated IDs:\n\n```ocaml\nlet sqids = Sqids.make ~blocklist:[\"86Rf07\"] () in\nlet id = Sqids.encode sqids [1; 2; 3] in (* \"se8ojk\" *)\nlet numbers = Sqids.decode sqids id in (* [1; 2; 3] *)\n```\n\n## 📝 License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-ocaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqids%2Fsqids-ocaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-ocaml/lists"}