BaseX (BaseX v1.3.2) View Source

coding for arbitrary alphabets and block sizes

Link to this section Summary

Link to this section Functions

Link to this function

prepare_module(name, alphabet, block_size)

View Source


prepare_module(String.t(), binary() | list() | tuple(), pos_integer()) :: term()

prepare a coding module

Returns the name of the module.

The resulting module will appear in the BaseX namespace and have encode and decode functions available.


iex> BaseX.prepare_module("Base2", "01", 4)

iex> BaseX.Base2.encode("Hi!")

iex> BaseX.Base2.decode("010010000110100100100001")

These functions are only suitable for complete messages. Streaming applications should manage their own incomplete message state.

The supplied module name should be both valid (by Elixir rules) and unique. Care should be taken when regenerating modules with the same name.

Alphabets may be defined by {"t","u","p","l","e"}, "string", 'charlist' or ["l","i","s","t"] as desired.