{"id":16947892,"url":"https://github.com/dop251/base64dec","last_synced_at":"2025-03-21T09:42:07.544Z","repository":{"id":202895107,"uuid":"708370702","full_name":"dop251/base64dec","owner":"dop251","description":"Universal Lenient Base64 Decoder","archived":false,"fork":false,"pushed_at":"2023-10-22T11:27:50.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T06:12:49.869Z","etag":null,"topics":["base64-decoding","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dop251.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-22T11:15:18.000Z","updated_at":"2024-03-17T13:39:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f244ac6-c03d-4be0-a660-a9384b333aaf","html_url":"https://github.com/dop251/base64dec","commit_stats":null,"previous_names":["dop251/base64dec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dop251%2Fbase64dec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dop251%2Fbase64dec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dop251%2Fbase64dec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dop251%2Fbase64dec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dop251","download_url":"https://codeload.github.com/dop251/base64dec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776270,"owners_count":20508503,"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-decoding","golang"],"created_at":"2024-10-13T21:48:49.403Z","updated_at":"2025-03-21T09:42:07.480Z","avatar_url":"https://github.com/dop251.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Lenient Base64 Decoder\n\nThis is a modified version of the standard base64 decoder from `encoding/base64`. Key differences:\n\n- Accepts both Standard and URL-safe encoding, no need to specify it explicitly.\n- Works for both padded and raw inputs.\n- The input can be a `string` or a `[]byte`, no allocation or copy is performed for either.\n\nThe goal was to create a decoder compatible with the one used in nodejs (and possibly elsewhere too). Unfortunately\nthe standard package does not expose enough API to do this efficiently, and trying all 4 possible variants\n(standard/url, padded/raw) seemed wasteful.\n\nBecause there is no need to convert the input from `string` to `[]byte`, decoding strings (specially long ones)\nis more efficient than with the standard library. Below is the comparison between `BenchmarkDecodeBase64Std`\nand `BenchmarkDecodeBase64` on go1.21.3:\n\n```\ngoos: linux\ngoarch: amd64\npkg: base64dec\ncpu: Intel(R) Core(TM) i7-2600S CPU @ 2.80GHz\n                    │    old.txt    │               new.txt               │\n                    │    sec/op     │   sec/op     vs base                │\nDecodeBase64/2-8       28.85n ±  3%   22.95n ± 2%  -20.45% (p=0.000 n=10)\nDecodeBase64/4-8       48.05n ±  0%   41.41n ± 1%  -13.83% (p=0.000 n=10)\nDecodeBase64/8-8       38.31n ±  2%   29.55n ± 1%  -22.89% (p=0.000 n=10)\nDecodeBase64/64-8      406.7n ±  5%   113.0n ± 2%  -72.20% (p=0.000 n=10)\nDecodeBase64/8192-8   31.670µ ± 10%   9.995µ ± 2%  -68.44% (p=0.000 n=10)\ngeomean                232.8n         126.0n       -45.89%\n\n                    │    old.txt    │                new.txt                 │\n                    │      B/s      │      B/s       vs base                 │\nDecodeBase64/2-8      132.2Mi ±  3%    166.2Mi ± 2%   +25.70% (p=0.000 n=10)\nDecodeBase64/4-8      158.8Mi ±  0%    184.2Mi ± 1%   +16.04% (p=0.000 n=10)\nDecodeBase64/8-8      298.7Mi ±  2%    387.3Mi ± 1%   +29.67% (p=0.000 n=10)\nDecodeBase64/64-8     206.4Mi ±  5%    742.4Mi ± 2%  +259.71% (p=0.000 n=10)\nDecodeBase64/8192-8   329.0Mi ± 11%   1042.4Mi ± 2%  +216.87% (p=0.000 n=10)\ngeomean               211.8Mi          391.4Mi        +84.81%\n\n                    │    old.txt     │                 new.txt                  │\n                    │      B/op      │    B/op      vs base                     │\nDecodeBase64/2-8        0.000 ± 0%      0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/4-8        0.000 ± 0%      0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/8-8        0.000 ± 0%      0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/64-8       96.00 ± 0%       0.00 ± 0%  -100.00% (p=0.000 n=10)\nDecodeBase64/8192-8   12.00Ki ± 0%     0.00Ki ± 0%  -100.00% (p=0.000 n=10)\ngeomean                            ²                ?                       ² ³\n¹ all samples are equal\n² summaries must be \u003e0 to compute geomean\n³ ratios must be \u003e0 to compute geomean\n\n                    │   old.txt    │                 new.txt                 │\n                    │  allocs/op   │ allocs/op   vs base                     │\nDecodeBase64/2-8      0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/4-8      0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/8-8      0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹\nDecodeBase64/64-8     1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)\nDecodeBase64/8192-8   1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)\ngeomean                          ²               ?                       ² ³\n¹ all samples are equal\n² summaries must be \u003e0 to compute geomean\n³ ratios must be \u003e0 to compute geomean\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdop251%2Fbase64dec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdop251%2Fbase64dec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdop251%2Fbase64dec/lists"}