{"id":16747705,"url":"https://github.com/bryanp/b3e","last_synced_at":"2026-02-26T16:04:13.761Z","repository":{"id":53787841,"uuid":"347271408","full_name":"bryanp/b3e","owner":"bryanp","description":"Fast Base62 for Ruby.","archived":false,"fork":false,"pushed_at":"2022-11-09T01:05:52.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-19T12:03:18.384Z","etag":null,"topics":["base62","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bryanp.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}},"created_at":"2021-03-13T04:26:21.000Z","updated_at":"2024-09-19T06:30:58.000Z","dependencies_parsed_at":"2023-01-21T09:03:01.992Z","dependency_job_id":null,"html_url":"https://github.com/bryanp/b3e","commit_stats":null,"previous_names":["metabahn/b3e"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bryanp/b3e","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanp%2Fb3e","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanp%2Fb3e/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanp%2Fb3e/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanp%2Fb3e/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryanp","download_url":"https://codeload.github.com/bryanp/b3e/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanp%2Fb3e/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29863817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: 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":["base62","ruby"],"created_at":"2024-10-13T02:10:42.690Z","updated_at":"2026-02-26T16:04:13.716Z","avatar_url":"https://github.com/bryanp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# b3e\n\nFast Base62 encoding/decoding for Ruby strings.\n\n```ruby\nrequire \"b3e\"\n\nB3e.encode(\"hello\")\n=\u003e \"vxGblhG\"\n\nB3e.decode(\"vxGblhG\")\n=\u003e \"hello\"\n```\n\n## Rationale\n\nBase62 creates url-safe, user-friendly strings from arbitrary bytes. It's similar to Base64 encoding, but restricted to\nan alphanumeric alphabet. This means that Base62 strings contain no special characters and can be easily selected by a\nuser, making them ideal for things that a user will interact with—like api keys.\n\nThis library pulls inspiration from the [glowfall/base62](https://github.com/glowfall/base62) and\n[jxskiss/base62](https://github.com/jxskiss/base62) projects to make encoding and decoding fast enough for nearly any\nuse case. Here's a benchmark for encoding 512 random bytes:\n\n```\n$ bundle exec ruby benchmarks/encode.rb\n\nWarming up --------------------------------------\n                 b3e    34.943k i/100ms\n              base64    36.338k i/100ms\nCalculating -------------------------------------\n                 b3e    368.076k (± 3.7%) i/s -      1.852M in   5.038917s\n              base64    355.178k (± 3.3%) i/s -      1.781M in   5.019292s\n\nComparison:\n                 b3e:   368076.4 i/s\n              base64:   355178.1 i/s - same-ish: difference falls within error\n```\n\nAnd here's a benchmark for decoding the encoded strings from above:\n\n```\n$ bundle exec ruby benchmarks/decode.rb\n\nWarming up --------------------------------------\n                 b3e    61.821k i/100ms\n              base64    35.402k i/100ms\nCalculating -------------------------------------\n                 b3e    612.307k (± 4.5%) i/s -      3.091M in   5.058411s\n              base64    312.973k (±11.0%) i/s -      1.558M in   5.040309s\n\nComparison:\n                 b3e:   612306.9 i/s\n              base64:   312973.3 i/s - 1.96x  (± 0.00) slower\n```\n\nCompared to Ruby's built-in Base64 encoder, `b3e` encodes at a similar rate but is actually *faster* at decoding.\n\n## Tradeoffs\n\n`b3e` is plenty fast, but it comes with a tradeoff. The encodings that `b3e` generates are less portable because it\nuses a different algorithm than most other Base62 encoders. Here's a comparison between `b3e` and `b3bm` (a Base62\nencoder that takes more of a standard tack):\n\n```ruby\nB3e.encode(\"hello\")\n=\u003e \"vxGblhG\"\n\nB3bm.encode(\"hello\")\n=\u003e \"7tQLFHz\"\n```\n\n*What this means is that encodings generated with `b3e` might not decode correctly by Base62 libraries in other\necosystems.* Base62 lacks a formally defined standard so there is already quite a bit of variability between\nlibraries, but keep this in mind if your encodings need to be consumed by other tools.\n\n## Alternatives\n\nHere's a couple other approaches in the Ruby ecosystem:\n\n* [`b3bm`](https://github.com/bryanp/b3bm): Counterpart to `b3e` that generates more portable encodings a lot more slowly.\n* [`base62-rb`](https://github.com/steventen/base62-rb): Base62 encoder/decoder for integers, implemented in Ruby.\n* [`yab62`](https://github.com/siong1987/yab62): Base62 encoder/decoder for integers, implemented in C.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanp%2Fb3e","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryanp%2Fb3e","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanp%2Fb3e/lists"}