BaseX v0.2.1 BaseX
coding for arbitrary alphabets and block sizes
Summary
Functions
prepare a coding module
Functions
Specs
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.
Example:
BaseX.prepare_module("Base2", "01", 4)
BaseX.Base2.encode("Hi!") # "010010000110100100100001"
BaseX.Base2.decode("010010000110100100100001") # "Hi!"
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 regenereating modules with the same name.
Alphabets may be defined by {"t","u","p","l","e"}
, "string"
, 'charlist'
or
["l","i","s","t"]
as desired.