https://github.com/marthijn/sidio.text.base32
Base32 encoding and decoding in .NET
https://github.com/marthijn/sidio.text.base32
base32 base32hex dotnet encoding rfc4648
Last synced: 7 months ago
JSON representation
Base32 encoding and decoding in .NET
- Host: GitHub
- URL: https://github.com/marthijn/sidio.text.base32
- Owner: marthijn
- License: mit
- Created: 2024-10-03T19:10:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-25T14:20:27.000Z (7 months ago)
- Last Synced: 2025-10-25T16:19:17.892Z (7 months ago)
- Topics: base32, base32hex, dotnet, encoding, rfc4648
- Language: C#
- Homepage:
- Size: 68.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sidio.Text.Base32
A simple .NET package that converts a byte array to a [Base32](https://en.wikipedia.org/wiki/Base32) string and vice versa. Because the latest framework
features are used, .NET 8.0 or higher is required.
[](https://github.com/marthijn/Sidio.Text.Base32/actions/workflows/build.yml)
[](https://www.nuget.org/packages/Sidio.Text.Base32/)
[](https://coveralls.io/github/marthijn/Sidio.Text.Base32?branch=main)
# Usage
## Encode
```csharp
var myString = "foobar";
var bytes = Encoding.UTF8.GetBytes(myString);
var base32 = Base32.Encode(bytes);
```
## Decode
```csharp
var base32 = "MZXW6YTBOI======";
var bytes = Base32.Decode(base32);
var myString = Encoding.UTF8.GetString(bytes);
```
## Encode hex
```csharp
var myString = "foobar";
var bytes = Encoding.UTF8.GetBytes(myString);
var base32 = Base32.EncodeHex(bytes);
```
## Decode hex
```csharp
var base32 = "CPNMUOJ1E8======";
var bytes = Base32.DecodeHex(base32);
var myString = Encoding.UTF8.GetString(bytes);
```
# References
* [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648)