Hexate
A simple module for hexadecimal encoding / decoding in Elixir
Usage
Encode to binary string:
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"
Decode to binary string:
iex> Hexate.decode("54686973206973206120746573742e")
"This is a test."
iex> Hexate.decode('54686973206973206120746573742e')
"This is a test."
Encode to list:
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'
Decode to list:
iex> Hexate.decode_to_list('54686973206973206120746573742e')
'This is a test.'
iex> Hexate.decode_to_list("54686973206973206120746573742e")
'This is a test.'
Convert hexate to integer:
iex> Hexate.to_integer('54686973206973206120746573742e')
438270661302729020147902120434299950
iex> Hexate.to_integer("54686973206973206120746573742e")
438270661302729020147902120434299950