hexate v0.6.1 Hexate

A simple module to convert to and from hex encoded strings.

Encodes / decodes both char-lists and strings.

Summary

Functions

Returns a decoded binary from a hex string in either char-list or string form

Returns a decoded char-list from a hex string in either char-list or string form

Returns a hex encoded string from a char-list, string or integer

Returns a hex encoded list from a char-list, string or integer

Returns an integer representation of a given string of hex, taking a char-list or a string as an argument

Functions

decode(hex_str)

Returns a decoded binary from a hex string in either char-list or string form.

Examples

iex> Hexate.decode("54686973206973206120746573742e")
"This is a test."

iex> Hexate.decode('54686973206973206120746573742e')
"This is a test."
decode_to_list(hex_str)

Returns a decoded char-list from a hex string in either char-list or string form.

Examples

iex> Hexate.decode_to_list("54686973206973206120746573742e")
'This is a test.'

iex> Hexate.decode_to_list('54686973206973206120746573742e')
'This is a test.'
encode(int, digits \\ 1)

Returns a hex encoded string from a char-list, string or integer.

Examples

iex> Hexate.encode("This is a test.")
"54686973206973206120746573742e"

iex> Hexate.encode('This is a test.')
"54686973206973206120746573742e"

iex> Hexate.encode(123456)
"1e240"

iex> Hexate.encode(15, 4)
"000f"

iex> Hexate.encode(15.0, 2)
"0f"

iex> Hexate.encode(15.0)
"f"
encode_to_list(str)

Returns a hex encoded list from a char-list, string or integer.

Examples

iex> Hexate.encode_to_list("This is a test.")
'54686973206973206120746573742e'

iex> Hexate.encode_to_list('This is a test.')
'54686973206973206120746573742e'

iex> Hexate.encode_to_list(123456)
'1e240'
to_integer(hex_str)

Returns an integer representation of a given string of hex, taking a char-list or a string as an argument.

Examples

iex> Hexate.to_integer('54686973206973206120746573742e')
438270661302729020147902120434299950

iex> Hexate.to_integer("54686973206973206120746573742e")
438270661302729020147902120434299950