Skip to main content

py-multibase

https://img.shields.io/pypi/v/py-multibase.svg https://img.shields.io/travis/multiformats/py-multibase.svg?branch=master https://codecov.io/gh/multiformats/py-multibase/branch/master/graph/badge.svg Documentation Status

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.

Installation

$ pip install py-multibase

Sample Usage

>>> # encoding a buffer
>>> from multibase import encode, decode
>>> encode('base58btc', 'hello world')
b'zStV1DL6CwTryKyV'
>>> encode('base64', 'hello world')
b'mGhlbGxvIHdvcmxk'
>>> # 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

History

1.0.0 (2018-10-19)

  • Re-implement encoding for base32 and base64, as the implementation was buggy

  • Add extensive tests for all encodings

0.1.0 (2017-09-02)

  • First release on PyPI.

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-1.0.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_multibase-1.0.0-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file py-multibase-1.0.0.tar.gz.

File metadata

  • Download URL: py-multibase-1.0.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.5

File hashes

Hashes for py-multibase-1.0.0.tar.gz
Algorithm Hash digest
SHA256 de5f5331b6a37c262ea30b16ba258323e4418c4c62f8e834682ab804d9420965
MD5 83bfd5650ca4a21eed41b5b93f84d65f
BLAKE2b-256 d0a31378f82c42cc818e574f0978b763f35900b7a9c6481fcddb94e32ea83636

See more details on using hashes here.

File details

Details for the file py_multibase-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for py_multibase-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a6b17063b46c4ba5774c34007e222c43725354308392a1c06da34a98a44b50ef
MD5 d03b41c20ca1d78426008f8acf097317
BLAKE2b-256 16589fa31901291266138cbf7421468bdfbe9df30427c65d03f84b0709812771

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page