BaseX v0.1.0 BaseX

coding for arbitrary alphabets and block sizes

Summary

Functions

prepare a coding module

Functions

prepare_module(name, abc, bs)

Specs

prepare_module(String.t, binary | list | tuple, pos_integer) :: {:ok, pid}

prepare a coding 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. Modules cannot be redefined over another with the same name.

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