ByteDev.Encoding 1.1.0

Library of encoding/decoding related functionality for Hexadecimal, Base64 and Base32.

Install-Package ByteDev.Encoding -Version 1.1.0
dotnet add package ByteDev.Encoding --version 1.1.0
<PackageReference Include="ByteDev.Encoding" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ByteDev.Encoding --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ByteDev.Encoding, 1.1.0"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

ByteDev.Encoding

Library of encoding/decoding related functionality for Base64 and Hexadecimal.

Installation

ByteDev.Encoding has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.

ByteDev.Encoding is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:

Install-Package ByteDev.Encoding

Further details can be found on the nuget page.

Release Notes

Releases follow semantic versioning.

Full details of the release notes can be viewed on GitHub.

Usage

The main library classes include:

  • Base32Encoder
  • Base64Encoder
  • HexEncoder
  • Serializer
  • EncoderFactory

String extension methods:

  • IsBase32
  • IsBase64
  • IsHex

Char extension methods:

  • IsBase32
  • IsBase64
  • IsHex

Base32Encoder

Base32Encoder provides a way to encode to base32 strings and decode back again.

IEncoder encoder = new Base32Encoder();

string base32 = encoder.Encode("John");

// base32 == "JJXWQ3Q="

string text = encoder.Decode(base32);

// text == "John"

Base64Encoder

Base64Encoder provides a way to encode to base64 strings and decode back again.

IEncoder encoder = new Base64Encoder();

string base64 = encoder.Encode("John");

// base64 == "Sm9obg=="

string text = encoder.Decode(base64);

// text == "John"

HexEncoder

HexEncoder provides a way to encode to hexadecimal strings and decode back again.

IEncoder encoder = new HexEncoder('='); // optional delimiter arg

string hex = encoder.Encode("John");

// hex == "4A=6F=68=6E"

string text = encoder.Decode(hex);

// text == "John"

Serializer

The Serializer class provides a way to serialize/deserialize objects based on the provided IEncoder implementation (Base32, Base64 or Hex).

// Entity to serialize
[Serializable]
public class Person
{
    public string Name { get; set; }
}

// ...

var person = new Person { Name = "John Smith" }
// Setup serializer
IEncoder encoder = new Base64Encoder();

ISerializer serializer = new Serializer(encoder);
// Serialize
string base64 = serializer.Serialize(person);
// Deserialize
Person person = serializer.Deserialize<Person>(base64);

EncoderFactory

The EncoderFactory provides a convenient way to create a type of encoder based on the EncodingType.

IEncoderFactory factory = new EncoderFactory();

IEncoder base64Encoder = factory.Create(EncodingType.Base64);

ByteDev.Encoding

Library of encoding/decoding related functionality for Base64 and Hexadecimal.

Installation

ByteDev.Encoding has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.

ByteDev.Encoding is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:

Install-Package ByteDev.Encoding

Further details can be found on the nuget page.

Release Notes

Releases follow semantic versioning.

Full details of the release notes can be viewed on GitHub.

Usage

The main library classes include:

  • Base32Encoder
  • Base64Encoder
  • HexEncoder
  • Serializer
  • EncoderFactory

String extension methods:

  • IsBase32
  • IsBase64
  • IsHex

Char extension methods:

  • IsBase32
  • IsBase64
  • IsHex

Base32Encoder

Base32Encoder provides a way to encode to base32 strings and decode back again.

IEncoder encoder = new Base32Encoder();

string base32 = encoder.Encode("John");

// base32 == "JJXWQ3Q="

string text = encoder.Decode(base32);

// text == "John"

Base64Encoder

Base64Encoder provides a way to encode to base64 strings and decode back again.

IEncoder encoder = new Base64Encoder();

string base64 = encoder.Encode("John");

// base64 == "Sm9obg=="

string text = encoder.Decode(base64);

// text == "John"

HexEncoder

HexEncoder provides a way to encode to hexadecimal strings and decode back again.

IEncoder encoder = new HexEncoder('='); // optional delimiter arg

string hex = encoder.Encode("John");

// hex == "4A=6F=68=6E"

string text = encoder.Decode(hex);

// text == "John"

Serializer

The Serializer class provides a way to serialize/deserialize objects based on the provided IEncoder implementation (Base32, Base64 or Hex).

// Entity to serialize
[Serializable]
public class Person
{
    public string Name { get; set; }
}

// ...

var person = new Person { Name = "John Smith" }
// Setup serializer
IEncoder encoder = new Base64Encoder();

ISerializer serializer = new Serializer(encoder);
// Serialize
string base64 = serializer.Serialize(person);
// Deserialize
Person person = serializer.Deserialize<Person>(base64);

EncoderFactory

The EncoderFactory provides a convenient way to create a type of encoder based on the EncodingType.

IEncoderFactory factory = new EncoderFactory();

IEncoder base64Encoder = factory.Create(EncodingType.Base64);

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ByteDev.Encoding:

Package Downloads
ByteDev.Crypto
Provides simple cryptographic related classes for hashing/verifying data, encrypting/decrypting data and creating random data in .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 142 12/11/2020
1.0.1 98 10/6/2020
1.0.0 343 6/9/2020