Library
Module
Module type
Parameter
Class
Class type
Base58 encoding functionality
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.
An alphabet defines the character associated with a given value
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.
val make_alphabet : string -> alphabet
make_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 -> bytes
encode alphabet data
encodes data
using alphabet
.
val decode : alphabet -> bytes -> bytes
decode alphabet data
decodes data
using alphabet
.
If data
contains character not included in alphabet
, Invalid_base58_character
exception is raised.