{"id":26925444,"url":"https://github.com/neilvallon/shortening","last_synced_at":"2025-04-02T02:37:26.512Z","repository":{"id":24792391,"uuid":"28206200","full_name":"neilvallon/shortening","owner":"neilvallon","description":"Fat free URLs","archived":false,"fork":false,"pushed_at":"2019-04-22T13:03:11.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T04:25:42.676Z","etag":null,"topics":["base64","base64url","bijective","encoder","go","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"Go","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/neilvallon.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}},"created_at":"2014-12-18T23:32:26.000Z","updated_at":"2022-06-06T13:24:45.000Z","dependencies_parsed_at":"2022-08-22T16:50:39.692Z","dependency_job_id":null,"html_url":"https://github.com/neilvallon/shortening","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/neilvallon%2Fshortening","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neilvallon%2Fshortening/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neilvallon%2Fshortening/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neilvallon%2Fshortening/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neilvallon","download_url":"https://codeload.github.com/neilvallon/shortening/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246744930,"owners_count":20826873,"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":["base64","base64url","bijective","encoder","go","url-shortener"],"created_at":"2025-04-02T02:37:25.748Z","updated_at":"2025-04-02T02:37:26.489Z","avatar_url":"https://github.com/neilvallon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shortening\nA bijective base\u003csub\u003e64\u003c/sub\u003e encoder for creating short URLs.\n\n\n## Padding significant\nMost encoders use decimal bases to convert characters.\nThis can waste space by refusing to use the zero-value in the most significant position.\n\nFor example, in base\u003csub\u003e10\u003c/sub\u003e the numbers **1**, **01**, **00001**,\nare all equivalent despite being padded with leading 0's.\n\nThis is why non-bijective encoders will skip values such as **A** and **AAA**\nin favor of possibly longer strings.\n\nBy using these values we can recover 64\u003csup\u003e(n-1)\u003c/sup\u003e IDs\nof length *n*.\n\n| Length | Radix\u003csub\u003e64\u003c/sub\u003e |   Shortening  | difference |\n|--------|--------------------|---------------|------------|\n|    1   |                 63 |            64 |          1 |\n|    2   |              4,032 |         4,096 |         64 |\n|    3   |            258,048 |       262,144 |       4096 |\n|    4   |         16,515,072 |    16,777,216 |    262,144 |\n|    5   |      1,056,964,608 | 1,073,741,824 | 16,777,216 |\n\n\n## Performance\n|  Benchmark   |  ns/op |\n|--------------|--------|\n|  Encode64    |   46.2 |\n|  Decode64    |   21.6 |\n|  Encode32    |   46.4 |\n|  Decode32    |   23.7 |\n\n* go1.12.4 darwin/amd64\n* Intel Xeon X5675 - 3.06 GHz\n\n## References\nWikipedia: [Bijective numeration](https://en.wikipedia.org/wiki/Bijective_numeration)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneilvallon%2Fshortening","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneilvallon%2Fshortening","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneilvallon%2Fshortening/lists"}