Bodu.Text.Encoding 1.0.0

dotnet add package Bodu.Text.Encoding --version 1.0.0
                    
NuGet\Install-Package Bodu.Text.Encoding -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bodu.Text.Encoding" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bodu.Text.Encoding" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Bodu.Text.Encoding" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bodu.Text.Encoding --version 1.0.0
                    
#r "nuget: Bodu.Text.Encoding, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bodu.Text.Encoding@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bodu.Text.Encoding&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Bodu.Text.Encoding&version=1.0.0
                    
Install as a Cake Tool

Bodu.Text.Encoding

API stability — Stable. The public API surface is committed; breaking changes are reserved for a major-version bump per SemVer.

Binary-to-text encodings for .NET 8 — Base16, Base32, Base45, Base58, Base62, Base64, Base85, and Bech32 — with a uniform static API, variant selection, encode-time formatting options, and decode-time leniency styles. Every encoding exposes span, string, UTF-8, and IBufferWriter<> surfaces with Try* and length-calculation overloads for allocation-free use.

Installation

dotnet add package Bodu.Text.Encoding

Targets net8.0. All types live in the Bodu.Text.Encoding namespace.

Encodings and variants

Encoding Variants (*Variant enum) Notes
Base16 Lower, Upper Hexadecimal
Base32 Standard (RFC 4648), HexExtended (RFC 4648 §7), Crockford, ZBase32
Base45 — RFC 9285 (QR payloads)
Base58 BitcoinFlickr, Ripple Base58Check adds a checksum for address-style payloads
Base62 —
Base64 Standard (RFC 4648), UrlSafe (§5), Mime (RFC 2045) Base64Url wraps the BCL URL-safe helpers
Base85 Ascii85 (Adobe/PDF), Z85 (ZeroMQ)
Bech32 Bech32Encoding checksum variants

API shape

Each encoding is a static class with a consistent surface:

using Bodu.Text.Encoding;

string hex = Base16.Encode(data, Base16Variant.Upper);
byte[] back = Base16.Decode(hex);

// Variant + formatting options
string b64 = Base64.Encode(data, Base64Variant.UrlSafe, BaseFormattingOptions.OmitPadding);

// Allocation-free
Span<char> dest = stackalloc char[Base32.GetEncodedLength(data.Length)];
Base32.TryEncode(data, dest, out int written, Base32Variant.Crockford);
  • Encode / Decode, TryEncode / TryDecode, GetEncodedLength / GetDecodedLength.
  • UTF-8 surfaces (EncodeToUtf8, DecodeFromUtf8) and IBufferWriter<byte> / IBufferWriter<char> overloads via BinaryEncodingExtensions.
  • BinaryEncodings provides variant-aware IBinaryEncoding instances for polymorphic selection.

BaseFormattingOptions (encode) toggles casing, line breaks, prefixes, spacing, and padding omission; BaseFormatStyles (decode) controls leniency — prefix tolerance, whitespace skipping, missing padding, and canonical-form enforcement.

Runnable samples

The repository ships offline, dotnet run-able sample projects for this package — the catalogue and variant tour, the formatting/parse-style knobs, checksummed Base58Check and Bech32 corruption detection, the BinaryEncodings registry, and a custom Base36 codec proven by the shipped contract-test base — under samples/Text.Encoding/.

Testing

Tests live in test/ as MSTest partial classes mirroring src/. Run tiers via the runsettings files at the solution root:

dotnet test Bodu.Text.Encoding/test/Bodu.Text.Encoding.Test.csproj --settings bvt.runsettings
dotnet test Bodu.Text.Encoding/test/Bodu.Text.Encoding.Test.csproj --settings regression.runsettings

Every encoding is held to the shared BinaryEncodingContractTests<TEncoding> base and driven by published BinaryEncodingKat vectors, with invalid-input handling pinned by InvalidEncodedTextKat rows.

License

MIT. © Bodu Pty. Ltd.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 531 9/24/2026
0.7.0 140 9/24/2026
0.6.0 60 9/24/2026
0.5.0 70 9/23/2026