View Source BitcoinLib.Crypto.BitUtils (BitcoinLib v0.4.7)

Bitwise operations

Link to this section Summary

Functions

Regroups a list of binaries into a single one

Converts a binary into a list of smaller binaries according to the bit size specification

Link to this section Functions

@spec combine([binary()]) :: binary()

Regroups a list of binaries into a single one

examples

Examples

iex> [<<6, 6::size(3)>>, <<61, 2::size(3)>>, <<203, 7::size(3)>>, <<44, 1::size(3)>>, <<10::size(4)>>]
...> |> BitcoinLib.Crypto.BitUtils.combine
<<6, 199, 171, 47, 150, 26>>
@spec split(binary(), integer()) :: [binary()]

Converts a binary into a list of smaller binaries according to the bit size specification

examples

Examples

iex> 0x6C7AB2F961A
...> |> Binary.from_integer()
...> |> BitcoinLib.Crypto.BitUtils.split(11)
[
  <<6, 6::size(3)>>,
  <<61, 2::size(3)>>,
  <<203, 7::size(3)>>,
  <<44, 1::size(3)>>,
  <<10::size(4)>>
]