BSV v0.1.0-dev.1 BSV.Util View Source
A collection of commonly used helper methods.
Link to this section Summary
Functions
Encodes the given binary data with the specified encoding scheme.
Generates random bits for the given number of bytes.
Link to this section Functions
Encodes the given binary data with the specified encoding scheme.
Options
The accepted encoding schemes are:
:base64
- Encodes the binary using Base64:hex
- Encodes the binary using Base16 (hexidecimal), using lower character case
Examples
iex> BSV.Util.encode("hello world", :base64)
"aGVsbG8gd29ybGQ="
iex> BSV.Util.encode("hello world", :hex)
"68656c6c6f20776f726c64"
Generates random bits for the given number of bytes.
Examples
iex> iv = BSV.Util.random_bytes(16)
...> bit_size(iv)
128