merkle_patricia_tree v0.2.5 MerklePatriciaTree.Trie.Helper

Functions to help with manipulating or working with tries.

Link to this section Summary

Functions

Returns the binary of a given a list of nibbles

Returns the nibbles of a given binary as a list

Link to this section Functions

Link to this function get_binary(l)
get_binary([integer]) :: binary

Returns the binary of a given a list of nibbles

Examples

iex> MerklePatriciaTree.Trie.Helper.get_binary([0x01, 0x0e, 0x02, 0x0f]) <<0x1e, 0x2f>>

iex> MerklePatriciaTree.Trie.Helper.get_binary([1, 2, 3]) <<0x1::4, 0x02::4, 0x03::4>>

iex> MerklePatriciaTree.Trie.Helper.get_binary([0, 1, 0, 2, 0, 3]) <<0x01, 0x02, 0x03>>

Link to this function get_nibbles(k)
get_nibbles(binary) :: [integer]

Returns the nibbles of a given binary as a list

Examples

iex> MerklePatriciaTree.Trie.Helper.get_nibbles(<<0x1e, 0x2f>>) [0x01, 0x0e, 0x02, 0x0f]

iex> MerklePatriciaTree.Trie.Helper.get_nibbles(<<0x1::4, 0x02::4, 0x03::4>>) [1, 2, 3]

iex> MerklePatriciaTree.Trie.Helper.get_nibbles(<<0x01, 0x02, 0x03>>) [0, 1, 0, 2, 0, 3]