Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

py-multibase

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

py-multibase

Multibase implementation for Python

  • 1.0.3
  • PyPI
  • Socket score

Maintainers
1

py-multibase

.. image:: https://img.shields.io/pypi/v/py-multibase.svg :target: https://pypi.python.org/pypi/py-multibase

.. image:: https://img.shields.io/travis/multiformats/py-multibase.svg?branch=master :target: https://travis-ci.org/multiformats/py-multibase?branch=master

.. image:: https://codecov.io/gh/multiformats/py-multibase/branch/master/graph/badge.svg :target: https://codecov.io/gh/multiformats/py-multibase

.. image:: https://readthedocs.org/projects/py-multibase/badge/?version=stable :target: https://py-multibase.readthedocs.io/en/stable/?badge=stable :alt: Documentation Status

Multibase <https://github.com/multiformats/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

.. code-block:: shell

$ pip install py-multibase

Sample Usage

.. code-block:: python

>>> # 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
  • base36
  • base36upper
  • base58flickr
  • base58btc
  • base64
  • base64url

History

1.0.3 (2020-10-26)

  • Add base36 and base36 upper encodings
  • Fix issue with base16 encoding

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc