Skip to content

A library to convert between byte arrays and strings using hex (base 16) encoding

License

Notifications You must be signed in to change notification settings

cgreenza/ByteTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ByteTools

A .Net library to convert between byte arrays and strings using hex (base 16) encoding i.e. each byte is represented by 2 hex characters.

The implementation makes use of an efficient table lookup that is approx 16x faster than using System.BitConverter:

System.BitConverter.ToString(x).Replace("-", "")

Examples in C#

To convert from hex string to byte array:

var b = HexEncoding.GetBytes("2FA5"); // returns new byte [] { 0x2f, 0xa5 }

To convert from byte array to hex string:

var s = HexEncoding.GetString(new byte[] { 0x2f, 0xa5 }); // returns "2FA5"

NuGet Package

Available from NuGet: https://www.nuget.org/packages/ByteTools

Build & Test Status

Build Status

About

A library to convert between byte arrays and strings using hex (base 16) encoding

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages