Spargine is a collection of open-source assemblies and NuGet packages designed for .NET 10, which I have been developing and maintaining since the release of .NET Framework 2. These assemblies are not only a core part of my projects but are also actively deployed in production environments across several companies I collaborate with.
Get Spargine
You can access the source code and NuGet packages here:
- GitHub: Spargine 10
- NuGet: dotNetDaveNuGet
Applications frequently need to represent binary data as compact text—for identifiers, activation keys, tracking codes, barcodes, URLs, and other values that people may need to read, type, or communicate verbally.
Traditional encoding formats can introduce characters that are easily confused. For example, the letter O may be mistaken for the number 0, while uppercase I, lowercase l, and the number 1 can appear nearly identical in many fonts.
Crockford Base32 was designed by Douglas Crockford to solve these problems. It is a human-friendly Base32 encoding format that minimizes ambiguity and makes encoded values easier to read, enter, and dictate. Spargine now provides built-in support for Crockford Base32 through the Crockford32 type in the DotNetTips.Spargine.Core assembly and NuGet package.
Understanding Crockford Base32
Crockford Base32 uses a carefully selected 32-character alphabet:
0123456789ABCDEFGHJKMNPQRSTVWXYZ
The letters I, L, O, and U are intentionally excluded. Removing these characters helps prevent confusion with the numbers 1 and 0 and reduces the possibility of encoded values accidentally containing inappropriate words.
Key Characteristics
- Case-insensitive decoding: Encoded values can be decoded regardless of whether uppercase or lowercase letters are used.
- Ambiguous-character substitutions: During decoding, O may be interpreted as 0, while I and L may be interpreted as 1.
- Five-bit encoding: Binary data is divided into five-bit groups, with each group mapped to a character in the Crockford Base32 alphabet.
- No required padding: Unlike RFC 4648 Base32, Crockford Base32 does not require = padding characters.
- Optional error detection: A check symbol selected from an expanded 37-character alphabet may be appended to help detect transcription errors.
- Human-friendly output: Encoded values are compact, readable, and easier to communicate accurately.
These characteristics make Crockford Base32 especially useful for human-facing values such as:
- Unique identifiers
- Product and activation keys
- Tracking codes
- Barcode data
- Shortened database keys
- Confirmation and verification codes
Crockford32 in Spargine
Spargine includes the Crockford32 type in the DotNetTips.Spargine.Core assembly and NuGet package. This type provides efficient encoding and decoding support for the Crockford Base32 format.
Spargine also uses Crockford32 internally within the BarcodeGenerator type to produce compact, readable values suitable for barcode generation.
Available Methods
Decode(string text)
Decodes a Crockford Base32-encoded string and returns the original data as a byte array.
This method is useful when an encoded identifier, key, or barcode value must be converted back into its original binary representation.
Encode(ReadOnlySpan<byte> data)
Encodes a span of bytes as a Crockford Base32 string.
Using ReadOnlySpan<byte> allows the method to process existing memory efficiently without requiring unnecessary array allocations or copies.
Summary
Crockford Base32 provides a practical alternative to traditional Base32 encoding when values must be handled by people as well as software. Its carefully designed alphabet reduces character ambiguity, eliminates mandatory padding, and produces compact values that are easier to read, type, and communicate.
With the Crockford32 type in DotNetTips.Spargine.Core, .NET developers can add Crockford Base32 encoding and decoding to their applications without implementing and maintaining the algorithm themselves. Whether you are generating identifiers, activation keys, tracking codes, or barcode data, Spargine makes it easier to create values that are both machine-efficient and human-friendly.
Get Involved!
The success of open-source projects like Spargine relies on community contributions. If you find these updates useful or have ideas for further improvements, I encourage you to contribute by:
- Submitting pull requests
- Reporting issues
- Suggesting new features
Your input is invaluable in making Spargine an even more powerful tool for the .NET community.
If you are interested in contributing or have any questions, feel free to contact me via email at dotnetdave@live.com. Your support and collaboration are greatly appreciated!
Thank you, and happy coding!
Pick up any books by David McCarter by going to Amazon.com: http://bit.ly/RockYourCodeBooks
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
If you liked this article, please buy David a cup of Coffee by going here: https://www.buymeacoffee.com/dotnetdave
© The information in this article is copywritten and cannot be reproduced in any way without express permission from David McCarter.
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.

