Hex Encoding
Hex encoding. An extremely fast and synchronous JS implementation.
If you can make this faster without using WASM or async stuff please ping me.
Install
npm install --save hex-encoding
Usage
import Hex from 'hex-encoding';
{
const raw = 'Hello 😃';
const uint8 = new TextEncoder ().encode ( raw );
console.log ( uint8 );
const encoded = Hex.encode ( uint8 );
console.log ( encoded );
const decoded = Hex.decode ( encoded );
console.log ( decoded );
}
{
const raw = 'Hello 😃';
const encoded = Hex.encodeStr ( raw );
console.log ( encoded );
const decoded = Hex.decodeStr ( encoded );
console.log ( decoded );
}
{
console.log ( Hex.is ( '48656c6c6f20f09f9883' ) );
console.log ( Hex.is ( '😃' ) );
}
License
MIT © Fabio Spampinato