module B58:sig..end
This module implement both encoding and decoding functionality
for the Base58 encoding.
More information can be found here.
This encoding is well suited to encode large integer values
but not large binary data.
Both encode and decode have a quadratic performance with
respect to the length of the binary data.
type alphabet
For instance the binary alphabet would "01" while the hexadecimal
one would be "0123456789ABCDEF".
Since this module only focuses with Base 58 encoding the alphabet must
be created with 58 unique characters.
exception Invalid_alphabet
val make_alphabet : string -> alphabetmake_alphabet s creates a base 58 alphabet.
If s length is different than 58 characters then Invalid_alphabet
exception is raised.
val encode : alphabet -> bytes -> bytesencode alphabet data encodes data using alphabet.exception Invalid_base58_character
val decode : alphabet -> bytes -> bytesdecode alphabet data decodes data using alphabet.
If data contains character not included in alphabet,
Invalid_base58_character exception is raised.