Base45Utility 1.6.1
dotnet add package Base45Utility --version 1.6.1
NuGet\Install-Package Base45Utility -Version 1.6.1
<PackageReference Include="Base45Utility" Version="1.6.1" />
<PackageVersion Include="Base45Utility" Version="1.6.1" />
<PackageReference Include="Base45Utility" />
paket add Base45Utility --version 1.6.1
#r "nuget: Base45Utility, 1.6.1"
#:package Base45Utility@1.6.1
#addin nuget:?package=Base45Utility&version=1.6.1
#tool nuget:?package=Base45Utility&version=1.6.1
Base45Utility
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
Spanoverloads on modern targets. - Multi-targets
netstandard2.0,net8.0,net9.0, andnet10.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.
nullinput throwsArgumentNullException.DecodethrowsInvalidOperationExceptionfor an illegal character, an invalid length (a Base45 string length is always3nor3n+2), or a group that decodes to a value outside the valid byte/two-byte range.- The
Spandecode overload throwsArgumentExceptionif the destination buffer is too small.
License
Licensed under the Apache License, Version 2.0.
| Product | Versions 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. |
-
.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.