![]() |
VOOZH | about |
dotnet add package SimpleBase --version 5.6.1
NuGet\Install-Package SimpleBase -Version 5.6.1
<PackageReference Include="SimpleBase" Version="5.6.1" />
<PackageVersion Include="SimpleBase" Version="5.6.1" />Directory.Packages.props
<PackageReference Include="SimpleBase" />Project file
paket add SimpleBase --version 5.6.1
#r "nuget: SimpleBase, 5.6.1"
#:package SimpleBase@5.6.1
#addin nuget:?package=SimpleBase&version=5.6.1Install as a Cake Addin
#tool nuget:?package=SimpleBase&version=5.6.1Install as a Cake Tool
👁 NuGet Version
👁 Build Status
This is my own take for exotic base encodings like Base32, Base58 and Base85. I started to write it in 2013 as coding practice and kept it as a small pet project. I suggest anyone who wants to brush up their coding skills to give those encoding problems a shot. They turned out to be more challenging than I expected. To grasp the algorithms I had to get a pen and paper to see how the math worked.
Convert.FromHexString() method since .NET 5.
This is mostly a baseline implementation now (except for when you need ModHex).To install it from NuGet:
Install-Package SimpleBase
If you need .NET Standard 2.0 compatible version for targeting older .NET Framework or .NET Core, use the 2.x release line instead. It's missing newer features, but still supported:
Install-Package SimpleBase -MaximumVersion 2.999.0
The basic usage for encoding a buffer into, say, Base32, is as simple as:
using SimpleBase;
byte[] myBuffer;
string result = Base32.Crockford.Encode(myBuffer, padding: true);
// you can also use "ExtendedHex" or "Rfc4648" as encoder flavors
Decoding is also similar:
using SimpleBase;
string myText = ...
byte[] result = Base32.Crockford.Decode(myText);
See the for more types of examples and full documentation.
Small buffer sizes are used (64 characters). They are closer to real life applications. Base58 performs really bad in decoding of larger buffer sizes, due to polynomial complexity of numeric base conversions.
BenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.7705/25H2/2025Update/HudsonValley2) AMD Ryzen 9 5950X 4.00GHz, 1 CPU, 32 logical and 16 physical cores .NET SDK 10.0.102 [Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3 DefaultJob : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| DotNet_Base64 | 22.93 ns | 0.413 ns | 0.345 ns | 0.0120 | 200 B |
| Base2_Default | 269.93 ns | 5.336 ns | 5.240 ns | 0.0625 | 1048 B |
| Base8_Default | 133.93 ns | 2.183 ns | 1.823 ns | 0.0219 | 368 B |
| Base16_UpperCase | 85.39 ns | 0.642 ns | 0.600 ns | 0.0167 | 280 B |
| Multibase_Base16_UpperCase | 96.92 ns | 1.783 ns | 3.260 ns | 0.0334 | 560 B |
| Base32_CrockfordWithPadding | 136.41 ns | 1.744 ns | 1.632 ns | 0.0138 | 232 B |
| Base36_LowerCase | 8,297.76 ns | 12.181 ns | 10.172 ns | - | 224 B |
| Base45_Default | 119.01 ns | 2.155 ns | 2.725 ns | 0.0129 | 216 B |
| Base58_Bitcoin | 7,333.59 ns | 46.523 ns | 43.518 ns | 0.0076 | 200 B |
| Base58_Monero | 180.92 ns | 1.260 ns | 1.117 ns | 0.0119 | 200 B |
| Base62_Default | 7,210.10 ns | 11.733 ns | 10.975 ns | 0.0076 | 192 B |
| Base85_Z85 | 138.75 ns | 0.786 ns | 0.735 ns | 0.0110 | 184 B |
| Base256Emoji_Default | 215.19 ns | 3.288 ns | 2.915 ns | 0.0162 | 272 B |
Decoding (80 character string, except Base45 which must use an 81 character string)
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| DotNet_Base64 | 104.14 ns | 1.107 ns | 1.035 ns | 0.0052 | - | 88 B |
| Base2_Default | 94.64 ns | 0.598 ns | 0.559 ns | 0.0024 | - | 40 B |
| Base8_Default | 94.38 ns | 1.376 ns | 1.149 ns | 0.0024 | - | 40 B |
| Base16_UpperCase | 48.49 ns | 0.128 ns | 0.107 ns | 0.0038 | - | 64 B |
| Base16_UpperCase_TextReader | 251.52 ns | 4.994 ns | 10.642 ns | 0.4966 | 0.0155 | 8312 B |
| Multibase_Base16_UpperCase | 51.67 ns | 0.143 ns | 0.126 ns | 0.0038 | - | 64 B |
| Multibase_TryDecode_Base16_UpperCase | 45.49 ns | 0.090 ns | 0.075 ns | - | - | - |
| Base32_Crockford | 96.56 ns | 0.793 ns | 0.619 ns | 0.0048 | - | 80 B |
| Base36_LowerCase | 3,167.34 ns | 22.424 ns | 18.725 ns | 0.0038 | - | 80 B |
| Base45_Default | 65.67 ns | 0.699 ns | 0.654 ns | 0.0048 | - | 80 B |
| Base58_Bitcoin | 3,545.49 ns | 11.770 ns | 9.829 ns | 0.0038 | - | 88 B |
| Base58_Monero | 75.63 ns | 1.222 ns | 1.083 ns | 0.0052 | - | 88 B |
| Base62_Default | 3,759.70 ns | 63.712 ns | 59.596 ns | 0.0038 | - | 88 B |
| Base85_Z85 | 237.43 ns | 0.770 ns | 0.601 ns | 0.0052 | - | 88 B |
| Base256Emoji_Default | 273.74 ns | 2.261 ns | 1.888 ns | 0.0062 | - | 104 B |
I'm sure there are areas for improvement. I didn't want to go further in optimizations which would hurt readability and extensibility. I might experiment on them in the future.
Test suite for Base32 isn't complete, I took most of it from RFC4648. Base58 really lacks a good spec or test vectors needed. I had to resort to using online converters to generate preliminary test vectors.
Base85 tests are also makseshift tests based on what output Cryptii produces. Contribution to missing test cases are greatly appreciated.
It's interesting that I wasn't able to reach .NET Base64's performance with Base16 with a straightforward managed code despite that it's much simpler. I was only able to match it after I converted Base16 to unsafe code with good independent interleaving so CPU pipeline optimizations could take place. Still not satisfied though. Is .NET's Base64 implementation native? Perhaps.
Thanks to all contributors who provided patches, and reported bugs.
Chatting about this pet project with my friends @detaybey, @vhallac, @alkimake and @Utopians at one of our friend's birthday encouraged me to finish this. Thanks guys.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on SimpleBase:
| Package | Downloads |
|---|---|
|
Makaretu.Dns
DNS data model with serializer/deserializer for the wire and master file format. |
|
|
Nethermind.Libp2p.Core
A libp2p implementation for .NET |
|
|
Ipfs.Core
Core objects and interfaces for IPFS. The InterPlanetary File System is the permanent web. It is a new hypermedia distribution protocol, addressed by content and identities. IPFS enables the creation of completely distributed applications. It aims to make the web faster, safer, and more open. |
|
|
KubeOps
This is an operator sdk written in c#. It enables a developer to create a custom controller for CRDs (CustomResourceDefinitions) that runs on kubernetes. |
|
|
SubstrateNetApi
Just another Substrate .NET API, written in NETStandard2.0 to provide maximum compatibility for Unity3D. |
Showing the top 14 popular GitHub repositories that depend on SimpleBase:
| Repository | Stars |
|---|---|
|
stratumauth/app
📱 Two-Factor Authentication (2FA) client for Android + Wear OS
|
|
|
GZTimeWalker/GZCTF
The GZ::CTF project, an open source CTF platform.
|
|
|
unosquare/passcore
A self-service password management tool for Active Directory
|
|
|
SnapXL/SnapX
SnapX is a free, open-source, cross-platform tool that lets you capture or record any area of your screen and instantly share it with a single keypress. Upload images, videos, text, and more to multiple supported destinations—all with ease. ShareX fork
|
|
|
TeslaFly01/SmartSqlT
🔥🔥🔥 SmartSQL 是一款方便、快捷的数据库文档查询、导出工具!该工具从最初支持CHM文档格式开始,通过不断地探索开发、集思广益和不断改进,又陆续支持Word、Excel、PDF、Html、Xml、Json、MarkDown等文档格式的导出。同时支持SqlServer、MySql、PostgreSQL、SQLite等多种数据库的文档查询和导出功能。
|
|
|
BasisVR/Basis
Basis is an open-source social framework for VR and Desktop usage.
|
|
|
slowscript/warpinator-windows
An unofficial implementation of Warpinator for Windows
|
|
|
alnkesq/AppViewLite
A Bluesky appview focused on low resource consumption
|
|
|
umacryptosoft/USDT-TRC20-Wallet
USDT Wallet -TRX Wallet - TRC20 Wallet, Transfer
|
|
|
Doofus-Mc-Goofus/LonghornBluesky
Third-party Bluesky client designed with a Windows Longhorn-like aesthetic.
|
|
|
richardschneider/net-ipfs-mount
Mount the InterPlanetary File System as a mapped drive on Windows
|
|
|
NethermindEth/dotnet-libp2p
A libp2p implementation for .NET in C#.
|
|
|
bizanc/Bizanc.io.Core
Bizanc Blockchain
|
|
|
richardschneider/net-ipfs-core
The core objects and interfaces of the interplanetary file system (IPFS)
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.6.1 | 716 | 6/17/2026 |
| 5.6.0 | 412,337 | 11/13/2025 |
| 5.5.0 | 108,284 | 9/14/2025 |
| 5.4.1 | 220,829 | 5/20/2025 |
| 5.3.0 | 6,463 | 5/18/2025 |
| 5.2.0 | 13,640 | 5/11/2025 |
| 5.1.0 | 5,999 | 5/11/2025 |
| 5.0.0 | 8,583 | 5/9/2025 |
| 4.3.0 | 85,308 | 5/5/2025 |
| 4.2.0 | 17,295 | 4/29/2025 |
| 4.0.2 | 1,313,616 | 9/19/2024 |
| 4.0.1 | 24,604 | 9/12/2024 |
| 4.0.0 | 1,554,412 | 11/10/2022 |
| 3.1.0 | 795,165 | 5/24/2021 |
| 3.0.3 | 6,625 | 5/24/2021 |
| 3.0.2 | 134,311 | 12/11/2020 |
| 3.0.1 | 105,764 | 2/14/2020 |
| 2.1.0 | 706,112 | 1/21/2020 |
# 5.6.1
# Improvements
- DividingCoder derivatives are now generally faster
- MoneroBase58 is now faster
- Update dependencies
## Fixes
- Fix a bug in buffer length calculation in DividingCoder derivatives that caused incorrect encoding/decoding (thanks to @marcasburnett)