This is an implementation of Multibase in Idris.
This can be used to encode and decode strings in different bases, such as 1, binary, octal, decimal, hexadecimal, 32bitshex, 58bits, and 64bits.
The API exposes two functions:
encode : BaseSymbol n -> String -> StringThis function takes a target base and an arbitrary string as input, and converts the string using the given base.
decode : String -> Either (MultibaseError Char) StringThis function decodes a string that has been encoded with the multibase format. It will return MultibaseError
if the format is not respected.
See Tests/Multibase.idr for examples.
-
Clone the project and
cdinto the project dir. -
Compile it:
idris --install idris-multibase.ipkg -
Import
Data.Multibaseand start usingencodeanddecode.