Base45Utility 1.6.1

dotnet add package Base45Utility --version 1.6.1
                    
NuGet\Install-Package Base45Utility -Version 1.6.1
                    
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="Base45Utility" Version="1.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Base45Utility" Version="1.6.1" />
                    
Directory.Packages.props
<PackageReference Include="Base45Utility" />
                    
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 Base45Utility --version 1.6.1
                    
#r "nuget: Base45Utility, 1.6.1"
                    
#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 Base45Utility@1.6.1
                    
#: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=Base45Utility&version=1.6.1
                    
Install as a Cake Addin
#tool nuget:?package=Base45Utility&version=1.6.1
                    
Install as a Cake Tool

Base45Utility

CI

A small, dependency-free Base45 encoding and decoding utility for .NET, implementing draft-faltstrom-base45-03 (the encoding used, among others, by the EU Digital COVID Certificate).

Features

  • Encode/decode between raw bytes and Base45 strings.
  • String helpers that treat text as UTF-8.
  • Strict decoding: rejects illegal characters, invalid lengths, and out-of-range groups.
  • Allocation-friendly Span overloads on modern targets.
  • Multi-targets netstandard2.0, net8.0, net9.0, and net10.0.

Installation

The package is published to GitHub Packages. Add the source once (replacing USERNAME and TOKEN with a GitHub username and a personal access token that has the read:packages scope):

dotnet nuget add source "https://nuget.pkg.github.com/iupsilon/index.json" \
  --name github-iupsilon --username USERNAME --password TOKEN --store-password-in-clear-text

Then reference it from your project:

dotnet add package Base45Utility
<PackageReference Include="Base45Utility" Version="1.6.0" />

Usage

Encoding

Base45 is a lightweight, stateless type; a single instance can be reused.

using Base45Utility;

var base45 = new Base45();

// From a string (encoded as UTF-8)
string encoded = base45.Encode("Hello world");        // "%69 VD82EK4F.KEA2"

// From raw bytes
byte[] bytes = System.Text.Encoding.UTF8.GetBytes("Hello world");
string encodedFromBytes = base45.Encode(bytes);       // same result

Decoding

var base45 = new Base45();
const string input = "%69 VD82EK4F.KEA2";

byte[] decodedBytes = base45.Decode(input);           // raw bytes
string decodedText  = base45.DecodeAsString(input);   // "Hello world" (UTF-8)

Span overloads (net8.0 and later)

For hot paths, zero/low-allocation overloads are available:

var base45 = new Base45();

// Encode directly from a span of bytes
ReadOnlySpan<byte> payload = stackalloc byte[] { 1, 2, 3 };
string encoded = base45.Encode(payload);

// Decode into a caller-provided buffer; returns the number of bytes written
Span<byte> destination = stackalloc byte[32];
int written = base45.Decode("%69 VD82EK4F.KEA2".AsSpan(), destination);

Behavior and error handling

  • String overloads assume UTF-8 for both directions.
  • Empty input round-trips to empty output.
  • null input throws ArgumentNullException.
  • Decode throws InvalidOperationException for an illegal character, an invalid length (a Base45 string length is always 3n or 3n+2), or a group that decodes to a value outside the valid byte/two-byte range.
  • The Span decode overload throws ArgumentException if the destination buffer is too small.

License

Licensed under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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.6.1 91 5/27/2026
1.5.0 471 2/2/2026
1.4.1 4,077 12/20/2023
1.4.0 2,042 10/22/2021
1.3.0 579 10/22/2021
1.2.0 721 9/7/2021
1.1.0 540 9/2/2021