W3WS.Util (w3ws v0.1.0)
Utility functions
Summary
Functions
Convert a hex string to a binary
Convert a hex string to an integer
Calculate the keccak256 hash of a binary, optionally encoding as hex
Convert a binary to hex
Functions
Link to this function
from_hex(hex)
Convert a hex string to a binary
Examples
iex> from_hex("0x010203")
<<1, 2, 3>>
iex> from_hex("0x")
""
iex> from_hex("")
""
Link to this function
integer_from_hex(arg)
Convert a hex string to an integer
Examples
iex> integer_from_hex("0x7")
7
Link to this function
keccak(binary, opts \\ [])
Calculate the keccak256 hash of a binary, optionally encoding as hex
Examples
iex> keccak("foo", hex?: true)
"0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d"
Link to this function
to_hex(binary)
Convert a binary to hex
Examples
iex> to_hex(<<1, 2, 3>>)
"0x010203"