NAME

Data::HexConverter - Fast hex to binary and binary to hex using SIMD aware C code

SYNOPSIS

use Data::HexConverter;

my $hex_ref = \"41424344";
my $binary  = Data::HexConverter::hex_to_binary($hex_ref);

my $hex     = Data::HexConverter::binary_to_hex(\$binary);

my $himpl   = Data::HexConverter::hex_to_binary_impl();
my $bimpl   = Data::HexConverter::binary_to_hex_impl();

DESCRIPTION

This module calls a C library that picks the best implementation for the current CPU at runtime.

On an AVX512 host it will use AVX512.

On most other hosts AVX2 will be used.

If the host is really old (unlikekly) will use SSE2 or scalar (even more unlikely).

The Perl API takes references to scalars, because the strings can be large.

FUNCTIONS

hex_to_binary(\$hexstr)

Takes a reference to a hex string, returns the decoded binary string.

binary_to_hex(\$binstr)

Takes a reference to a binary string, returns the hex encoded string.

hex_to_binary_impl()

Returns a short string with the name of the impl used for hex to bin.

binary_to_hex_impl()

Returns a short string with the name of the impl used for bin to hex.

AUTHOR

Jared Still

LICENSE

MIT License.