-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marthijn van den Heuvel
committed
Oct 4, 2024
1 parent
33f58a7
commit 7029073
Showing
7 changed files
with
74 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
# Sidio.Text.Base32 | ||
Base32 encoding and decoding in .NET | ||
A simple .NET package that converts a byte array to a Base32 string and vice versa. Because the latest framework | ||
features are used, it requires .NET 8.0 or higher. | ||
|
||
[![build](https://github.com/marthijn/Sidio.Text.Base32/actions/workflows/build.yml/badge.svg)](https://github.com/marthijn/Sidio.Text.Base32/actions/workflows/build.yml) | ||
[![NuGet Version](https://img.shields.io/nuget/v/Sidio.Text.Base32)](https://www.nuget.org/packages/Sidio.Text.Base32/) | ||
[![Coverage Status](https://coveralls.io/repos/github/marthijn/Sidio.Text.Base32/badge.svg?branch=main)](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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters