{"id":16940407,"url":"https://github.com/joho/alphakey","last_synced_at":"2025-03-21T06:40:48.927Z","repository":{"id":12966541,"uuid":"15645003","full_name":"joho/alphakey","owner":"joho","description":"Handy little library for converting ints to short strings (for things like url shorteners and the like)","archived":false,"fork":false,"pushed_at":"2017-12-22T23:39:07.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-26T03:26:19.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/joho.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}},"created_at":"2014-01-05T03:50:39.000Z","updated_at":"2017-12-22T23:39:08.000Z","dependencies_parsed_at":"2022-07-10T00:00:47.766Z","dependency_job_id":null,"html_url":"https://github.com/joho/alphakey","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Falphakey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Falphakey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Falphakey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho%2Falphakey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joho","download_url":"https://codeload.github.com/joho/alphakey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244752332,"owners_count":20504254,"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-13T21:06:59.977Z","updated_at":"2025-03-21T06:40:48.899Z","avatar_url":"https://github.com/joho.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlphaKey\n\nFor a [Codename](http://codename.io) project I was working on I needed human readable/shareable short keys, so I ended up reimplementing the solution found on [this stack overflow answer about \"Bijective Functions\"](http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047) in Go and figured it might be of use to anyone else who needs to put together a url shortener or the like.\n\n## Usage\n\nTo get going, just import this\n\n```go\nimport \"github.com/joho/alphakey\"\n```\n\nYou can either call a couple of the helper functions directly\n\n```go\nkey := alphakey.GetKeyForInt(198898042) // returns \"ninja\"\nnum := alphakey.GetIntForKey(\"dgt\")     // returns 1337\n```\n\nOr if you want a bit more control you can instantiate your own converter and control the alphabet used and any offset you might want\n\n```go\nconverter := \u0026alphakey.Converter{\n  alphakey.UnambiguousLowercaseAlphabet, // all lower case, no l or o, because humans\n  497,                                   // an arbitrary offset so early sharers don't get a or b\n}\n\nkey := converter.GetKey(1988483) // returns \"ninja\"\nnum := converter.GetInt(\"emq\")   // returns 1337\n```\n\nYou can also check the [godocs for AlphaKey](http://godoc.org/github.com/joho/alphakey)\n\n## Build Status\n\n[![wercker status](https://app.wercker.com/status/c6de7a7f75baca3f7e1848f674c9b8be/m \"wercker status\")](https://app.wercker.com/project/bykey/c6de7a7f75baca3f7e1848f674c9b8be)\n\n---\n\n\u0026copy; 2013 [John Barton](https://johnbarton.co/), MIT Licenced\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho%2Falphakey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoho%2Falphakey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho%2Falphakey/lists"}