{"id":34646031,"url":"https://github.com/lorisleitner/schrott-id","last_synced_at":"2026-05-25T00:36:57.358Z","repository":{"id":187512110,"uuid":"676177270","full_name":"lorisleitner/schrott-id","owner":"lorisleitner","description":"SchrottID is a library for generating short, non-consecutive and opaque IDs from unsigned integers.","archived":false,"fork":false,"pushed_at":"2023-08-16T20:54:44.000Z","size":212,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-22T22:55:31.721Z","etag":null,"topics":["library","obfuscation"],"latest_commit_sha":null,"homepage":"","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/lorisleitner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-08T15:49:33.000Z","updated_at":"2026-04-01T19:34:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"48a14965-013e-45d0-8f1f-1bf2e53d4225","html_url":"https://github.com/lorisleitner/schrott-id","commit_stats":null,"previous_names":["lorisleitner/schrott-id"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lorisleitner/schrott-id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorisleitner%2Fschrott-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorisleitner%2Fschrott-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorisleitner%2Fschrott-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorisleitner%2Fschrott-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lorisleitner","download_url":"https://codeload.github.com/lorisleitner/schrott-id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorisleitner%2Fschrott-id/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33456263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T19:21:36.376Z","status":"ssl_error","status_checked_at":"2026-05-24T19:21:10.562Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["library","obfuscation"],"created_at":"2025-12-24T17:45:47.634Z","updated_at":"2026-05-25T00:36:57.353Z","avatar_url":"https://github.com/lorisleitner.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SchrottID\n\n\u003cimg alt=\"Nuget\" src=\"https://img.shields.io/nuget/dt/SchrottID?logo=nuget\u0026label=NuGet\u0026link=https%3A%2F%2Fwww.nuget.org%2Fpackages%2FSchrottID%2F\"\u003e\n\nSchrottID is a library for generating short, non-consecutive and opaque IDs from unsigned integers.\nThese can be used to obfuscate integer primary keys from your database and prevent enumeration of rows and leaking other\nconfidential information\n(see [German tank problem](https://de.wikipedia.org/wiki/German_tank_problem)).\n\nSchrottIDs can be used where UUIDs would be impractical and too long to remember.\n\n```csharp\n// Choose a character set for your SchrottIDs\nstring alphabet = Alphabets.Base64;\n\n// Generate a permutation for your alphabet\n// The permutation is your \"key\" for encoding and decoding\n// You cannot decode IDs correctly without this key\nstring permutation = SchrottIdUtil.GeneratePermutation(alphabet);\n\n// Choose a minimum length for your SchrottIDs\nint minimumLength = 3;\n\n// Make sure to store the three parameters above\n\n// Create a encoder/decoder\nSchrottIdEncoder schrottId = new SchrottIdEncoder(alphabet, permutation, minimumLength);\n\n// A primary key from your database\nulong primaryKey = 420;\n\n// Encode primaryKey to a SchrottID that you can safely expose\nstring externalId = schrottId.Encode(primaryKey);\n// externalId = 9TN\n\n// Decode back into your internal ID\nulong decodedKey = schrottId.Decode(externalId);\n// decodedKey = 420\n```\n\nImplementations in other languages should very similar APIs. IDs generated by the same major version of the library are\nalways stable.\n\n---\n\n### Creating a new implementation\n\nImplementations in other languages are very welcome. Create a new folder for your implementation and submit a pull\nrequest. Use `test/control.txt` to verify your implementation. `C#` is the reference implementation.\n\n---\n\n\u003e This library is inspired by [block-id](https://github.com/drifting-in-space/block-id) and removes the dependency on a\n\u003e deterministic random number generator so implementations in other languages are easier. The libraries are not\n\u003e cross-compatible.\n\n\u003e Disclaimer: I'm not a cryptographer and IDs generated by this library can possibly be reversed engineered. Use with\n\u003e caution. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florisleitner%2Fschrott-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florisleitner%2Fschrott-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florisleitner%2Fschrott-id/lists"}