{"id":16301645,"url":"https://github.com/bbkr/squishyid","last_synced_at":"2025-10-18T16:14:10.453Z","repository":{"id":237101411,"uuid":"793607472","full_name":"bbkr/SquishyID","owner":"bbkr","description":"Shorten and obfuscate IDs in Rust language. ","archived":false,"fork":false,"pushed_at":"2025-02-06T22:50:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T11:55:51.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbkr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-04-29T14:39:58.000Z","updated_at":"2025-02-06T22:51:12.000Z","dependencies_parsed_at":"2024-05-02T00:45:15.688Z","dependency_job_id":"7450f0f7-7aa7-4fe9-a632-9aa97b14dbcd","html_url":"https://github.com/bbkr/SquishyID","commit_stats":null,"previous_names":["bbkr/squishyid"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkr%2FSquishyID","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkr%2FSquishyID/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkr%2FSquishyID/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkr%2FSquishyID/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbkr","download_url":"https://codeload.github.com/bbkr/SquishyID/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912993,"owners_count":21824065,"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":[],"created_at":"2024-10-10T20:55:15.585Z","updated_at":"2025-10-18T16:14:10.358Z","avatar_url":"https://github.com/bbkr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SquishyID\n\nShorten and obfuscate IDs in [Rust](https://www.rust-lang.org/) language.\n\nUseful for:\n\n* Hiding real database IDs in URLs or REST APIs.\n* Saving space where it is limited, like in SMS or Push messages.\n\n## Example\n\n```rust\n    use squishyid::SquishyID;\n\n    let s = SquishyID::new(\n        \"2BjLhRduC6Tb8Q5cEk9oxnFaWUDpOlGAgwYzNre7tI4yqPvXm0KSV1fJs3ZiHM\"\n    ).unwrap();\n\n    let encoded: String = s.encode(48888851145);\n    assert_eq!(encoded, \"1FN7Ab\");\n\n    let decoded: u64 = s.decode(\"1FN7Ab\").unwrap();\n    assert_eq!(decoded, 48888851145);\n```\n\n## Methods\n\n### new(key: \u0026str) -\u003e Result\u003cSelf, \u0026str\u003e\n\nConstructs new instance using given key.\n\n* It must consist of at least two unique unicode characters.\n* The **longer the key** - the **shorter encoded ID** will be.\n* Encoded ID will be **made exclusively out of characters from the key**.\n\nChoose your key characters wisely, for example:\n\n* For SMS messages generate key from `a-z,A-Z,0-9` range. You will get excellent shortening like `1234567890` -\u003e `380FQs`.\n* For NTFS file names generate key from `a-z` range. You will get good shortening and avoid case insensitivity collisions, like `1234567890` -\u003e `iszbmfx`.\n* When trolling generate key from Emojis. So `1234567890` will be represented as `😣😄😹😧😋😳`.\n\nErrors:\n\n* `Key must contain at least 2 characters.`\n* `Key must contain unique characters.`\n\n### encode(\u0026self, decoded: u64) -\u003e String\n\nEncodes number using characters from the key.\n\nNote that this should not be considered a strong encryption.\nIt does not contain consistency checks.\nAnd key is easy to reverse engineer with small amount of encoded/decoded samples given.\nTreat it as really, really fast obfuscation only.\n\n### decode(\u0026self, encoded: \u0026str) -\u003e Result\u003cu64, \u0026str\u003e\n\nDecodes string using characters from the key.\n\nErrors:\n\n* `Encoded value must contain at least 1 character.`\n* `Encoded value contains character not present in key.`\n* `Encoded value too big to decode.` - when it would cause u64 overflow.\n\n\n## Other implementations\n\n* [Raku](https://github.com/bbkr/TinyID)\n* [PHP](https://github.com/krowinski/tinyID)\n* [Perl](http://search.cpan.org/~bbkr/Integer-Tiny-0.3/lib/Integer/Tiny.pm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbkr%2Fsquishyid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbkr%2Fsquishyid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbkr%2Fsquishyid/lists"}