{"id":22191525,"url":"https://github.com/deniszykov/basen","last_synced_at":"2025-07-18T16:32:51.912Z","repository":{"id":39345498,"uuid":"334145164","full_name":"deniszykov/BaseN","owner":"deniszykov","description":"C# library for Base16/32/64 encoding/decoding. ","archived":false,"fork":false,"pushed_at":"2024-04-07T12:44:34.000Z","size":302,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T11:49:32.245Z","etag":null,"topics":["base16","base32","base64","base64url","hex","hexadecimal","zbase32"],"latest_commit_sha":null,"homepage":"","language":"C#","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/deniszykov.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":"2021-01-29T12:52:39.000Z","updated_at":"2024-07-31T09:10:53.000Z","dependencies_parsed_at":"2022-09-08T23:24:26.295Z","dependency_job_id":null,"html_url":"https://github.com/deniszykov/BaseN","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/deniszykov/BaseN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniszykov%2FBaseN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniszykov%2FBaseN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniszykov%2FBaseN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniszykov%2FBaseN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deniszykov","download_url":"https://codeload.github.com/deniszykov/BaseN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniszykov%2FBaseN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265793540,"owners_count":23829176,"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":["base16","base32","base64","base64url","hex","hexadecimal","zbase32"],"created_at":"2024-12-02T12:16:27.658Z","updated_at":"2025-07-18T16:32:51.864Z","avatar_url":"https://github.com/deniszykov.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![dotnet_build](https://github.com/deniszykov/BaseN/workflows/dotnet_build/badge.svg)\n\nIntroduction\n============\n\nThis is BaseN encoding library. It provides simple API for converting between binary and BaseN encoded text data.  \nAlso there is an implementation of `System.Text.Encoding` which provides complex streaming API with it's `Convert` methods.  \n\n(Un)desired feature of this library, any invalid symbols (e.g. line breaks) during decoding are ignored.  \n\nSupported encoding alphabets are `Base16` aka `Hex`, `Base32`, `ZBase32`, `Base64`, `Base64Url`.  \n\nInstallation\n============\n```\nInstall-Package deniszykov.BaseN\n```\n\nUsage\n============\n\n#### Utility classes\n```csharp\nBase64Convert.ToString(bytes);\nBase64Convert.ToCharArray(bytes);\nBase64Convert.ToBytes(string); // (+ 6 overloads)\n\n// also\n// Base64UrlConvert\n// Base32Convert\n// ZBase32Convert\n// HexConvert \n```\n\n## Example\n```csharp\nusing deniszykov.BaseN;\n\nvar bytes = Base64Convert.ToBytes(\"eg==\");\n// bytes[0] -\u003e 122\n```\n\n## Using BaseNEncoding class\n```csharp\nusing deniszykov.BaseN;\n\nvar encoding = BaseNEncoding.Base64;\nvar input = \"eg==\".ToCharArray();\nvar output = new byte[1024];\nvar decoder = encoding.GetDecoder();\n\ndecoder.Convert(input, 0, input.Length, output, 0, output.Length, flush: true, out var inputUsed, out var outputUsed, out var completed);\n\n// completed -\u003e true\n// inputUsed -\u003e 4\n// outputUsed -\u003e 1\n// output[0] -\u003e 122\n```\nThere is overload of `Convert` accepting pointers and `Span\u003cT\u003e`'s.  \n\n## Using custom alphabet\n\n```csharp\nusing deniszykov.BaseN;\n\nvar binHex4Alphabet = new BaseNAlphabet(\"!\\\"#$%\u0026'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr\".ToCharArray());\nvar encoding = new BaseNEncoding(binHex4Alphabet, \"mac-binhex40\");\n```\n\n## Performance\n[Benchmark Code](src/deniszykov.BaseN.Benchmark/Base32EncodeBenchmarks.cs)  \n[Benchmark Result](src/deniszykov.BaseN.Benchmark/Benchmark_Results.txt)  \n```\n|                                 Method |      Mean | Ratio |    Gen 0 | Allocated |\n|--------------------------------------- |----------:|------:|---------:|----------:|\n|           System_Memory_Base64ToString |  15.57 ms |  0.32 | 125.0000 |  26.67 MB |\n|             BaseN_BaseNDecoder_Convert |  29.00 ms |  0.59 | 125.0000 |  26.67 MB |\n|           BaseN_Base64Convert_ToString |  39.60 ms |  0.80 | 230.7692 |  53.33 MB |\n|           BaseN_Base32Convert_ToString |  46.40 ms |  0.94 | 181.8182 |     64 MB |\n|          System_Convert_ToBase64String |  49.21 ms |  1.00 | 181.8182 |  53.33 MB |\n| Wiry_Base32Encoding_Standard_GetString |  96.24 ms |  1.96 | 500.0000 |    128 MB |\n|       SimpleBase_Base32_Rfc4648_Encode |  99.23 ms |  2.02 | 166.6667 |     64 MB |\n|                  Albireo_Base32_Encode | 150.08 ms |  3.04 | 500.0000 |    128 MB |\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniszykov%2Fbasen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeniszykov%2Fbasen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniszykov%2Fbasen/lists"}