ByteDev.Encoding 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ByteDev.Encoding --version 2.0.0                
NuGet\Install-Package ByteDev.Encoding -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ByteDev.Encoding" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ByteDev.Encoding --version 2.0.0                
#r "nuget: ByteDev.Encoding, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ByteDev.Encoding as a Cake Addin
#addin nuget:?package=ByteDev.Encoding&version=2.0.0

// Install ByteDev.Encoding as a Cake Tool
#tool nuget:?package=ByteDev.Encoding&version=2.0.0                

ByteDev.Encoding

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

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="

bool isBase32 = base32.IsBase32();
// isBase32 == true

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=="

bool isBase64 = base64.IsBase64();
// isBase64 == true

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"

bool isHex = hex.IsHex('=');
// isHex == true

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);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 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.

Casper.Net.Sdk

C# SDK For the Casper Network

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 6,377 1/12/2024
2.0.0 32,938 5/31/2021
1.1.0 1,087 12/11/2020
1.0.1 450 10/6/2020
1.0.0 1,467 6/9/2020