multibase

multi^2_base

multi2base = 100% pure Koltin Multiplatform Multibase Encoder/Decoder

This is a port of Protocol Labs' Kotlin/JVM multibase implementation to Kotlin multiplatform with significant help from Matthew Nelson's awesome encoding library and Uglješa Jovanović's KMP bignum library.

This project includes the original Protocol Labs repository as a git submodule for it's test vectors, but does not incorporate any code form it in releases.

multi2base supports the following multibase encodings:

  • BASE10

  • BASE16

  • BASE16_UPPER

  • BASE32

  • BASE32_UPPER

  • BASE32_PAD

  • BASE32_PAD_UPPER

  • BASE32_HEX

  • BASE32_HEX_UPPER

  • BASE32_HEX_PAD

  • BASE32_HEX_PAD_UPPER

  • BASE58_FLICKR

  • BASE58_BTC

  • BASE64

  • BASE64_URL

  • BASE64_PAD

  • BASE64_URL_PAD

Full documentation.

Using in your Projects

This library is available at maven central.

Gradle

dependencies {
implementation("at.asitplus:multibase:$version")
}

Note: This library exposes Matthew Nelson's Base64, Base32, and Base16 encoders as API dependency!

API

Simply MultiBase.decode(from_multibase_string) or MutltiBase.encode(Base.<desired>, any_byte_array) to a multibase string or use the extension functions:

  • multibase_string.multibaseDecode()

  • byteArray.multibaseEncode(Base.<desired>)

Note: Base10 and Base58 don't perform well. Only use those on small (<4KiB) data.

'Nuff said!


The MIT license does not apply to the project logo and the A-SIT logo, as these are the sole property of A-SIT/A-SIT Plus GmbH and may not be used without explicit permission!

Packages

Link copied to clipboard
common