Skip to main content

Multibase implementation for Python

Project description Documentation Status Updates

Multibase implementation for Python

Multibase is a protocol for distinguishing base encodings and other simple string encodings, and for ensuring full compatibility with program interfaces.

It answers the question: Given data d encoded into string s, how can I tell what base d is encoded with?

Base encodings exist because transports have restrictions, use special in-band sequences, or must be human-friendly. When systems chose a base to use, it is not always clear which base to use, as there are many tradeoffs in the decision. Multibase is here to save programs and programmers from worrying about which encoding is best.

It solves the biggest problem: a program can use multibase to take input or produce output in whichever base is desired.

The important part is that the value is self-describing, letting other programs elsewhere know what encoding it is using.


$ pip install py-multibase

Sample Usage

>>> # encoding a buffer
>>> from multibase import encode, decode
>>> encode('base58btc', 'hello world')
>>> encode('base64', 'hello world')
>>> # decoding a multibase
>>> decode('mGhlbGxvIHdvcmxk')
b'hello world'
>>> decode(b'zStV1DL6CwTryKyV')
b'hello world'
>>> decode(encode('base2', b'hello world'))
b'hello world'

Supported codecs

  • base2

  • base8

  • base10

  • base16

  • base16

  • base16

  • base32hex

  • base32

  • base32z

  • base58flickr

  • base58btc

  • base64

  • base64url


0.1.0 (2017-09-02)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-multibase-0.1.2.tar.gz (19.0 kB view hashes)

Uploaded Source

Built Distribution

py_multibase-0.1.2-py2.py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page