Base58Encoding 1.1.1

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

Base58Encoding

A high-performance .NET 10 Base58 encoding and decoding library with support for multiple alphabet variants.

Features

  • Multiple Alphabets: Built-in support for Bitcoin (IPFS/Sui/Solana), Ripple, and Flickr alphabets
  • Optimized Hot Paths: Firedancer-based fast paths for 32-byte and 64-byte inputs (up to 15x faster than SimpleBase)
  • Zero-allocation API: Encode and decode directly into caller-owned buffers
  • SIMD: Uses Vector256 for counting leading zeros

Alphabets

Property First Character Used By
Base58.Bitcoin 1 Bitcoin, IPFS, Solana, Sui, Monero
Base58.Ripple r Ripple (XRP)
Base58.Flickr 1 Flickr short URLs

API

Allocating API

string Encode(ReadOnlySpan<byte> data)

Encodes data and returns a new Base58 string. Returns "" for empty input.

byte[] Decode(ReadOnlySpan<char> encoded)

Decodes a Base58 string and returns a new byte array. Throws ArgumentException on invalid characters.

Zero-allocation API

int Encode(ReadOnlySpan<byte> data, Span<byte> destination)

Encodes data as ASCII Base58 bytes into destination. Returns the number of bytes written. Throws ArgumentException if destination is too small. Use Base58.GetMaxEncodedLength to size the buffer.

int Decode(ReadOnlySpan<char> encoded, Span<byte> destination)
int Decode(ReadOnlySpan<byte> encoded, Span<byte> destination)

Decodes Base58 chars (or ASCII bytes) into destination. Returns the number of bytes written. Throws ArgumentException on invalid characters or if destination is too small. Use Base58.GetTypicalDecodedLength to size the buffer for typical inputs.

Buffer sizing helpers

static int Base58.GetMaxEncodedLength(int byteCount)

Returns a safe upper bound for the number of Base58 characters produced from byteCount bytes. Formula: byteCount * 138 / 100 + 1. Use this to size the destination buffer for Encode.

static int Base58.GetTypicalDecodedLength(int encodedLength)

Returns a typical upper bound for the decoded byte count from an encoded input of encodedLength characters. Formula: encodedLength * 733 / 1000 + 1. Suitable for inputs without leading 1 characters. For inputs that may contain leading 1s, size the destination at encodedLength (safe upper bound).

Usage

Allocating API

using Base58Encoding;

byte[] data = { 0x01, 0x02, 0x03, 0x04 };

string encoded = Base58.Bitcoin.Encode(data);
byte[] decoded = Base58.Bitcoin.Decode(encoded);

// Ripple / Flickr alphabets
string ripple  = Base58.Ripple.Encode(data);
string flickr  = Base58.Flickr.Encode(data);

Zero-allocation API

using Base58Encoding;

byte[] data = { 0x01, 0x02, 0x03, 0x04 };

// Encode into a caller-owned buffer
Span<byte> encodedBytes = stackalloc byte[Base58.GetMaxEncodedLength(data.Length)];
int written = Base58.Bitcoin.Encode(data, encodedBytes);

// Decode from a byte span into a caller-owned buffer
Span<byte> decodedBytes = stackalloc byte[Base58.GetTypicalDecodedLength(written)];
int decodedLen = Base58.Bitcoin.Decode(encodedBytes[..written], decodedBytes);

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.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.1.1 387 4/27/2026
1.1.0 194 4/22/2026
1.0.0 126 1/8/2026
0.0.4 79 1/8/2026
0.0.3 248 8/26/2025
0.0.2 224 8/26/2025
0.0.1 222 8/26/2025