Coder Social home page Coder Social logo

py-multicodec's Introduction

This project is no longer maintained and has been archived.

py-multicodec

https://img.shields.io/travis/multiformats/py-multicodec.svg?branch=master Documentation Status

Multicodec implementation in Python

multicodec is a self-describing multiformat, it wraps other formats with a tiny bit of self-description.

A multicodec identifier is both a varint and the code identifying the following data, this means that the most significant bit of every multicodec code is reserved to signal the continuation.

You can check the table here for the list of supported codecs by py-multicodec.

Installation

$ pip install py-multicodec

Sample Usage

>>> from multicodec import add_prefix, remove_prefix, get_codec
>>> # adding a prefix to existing data
>>> add_prefix('sha2-256', b'EiC5TSe5k00')
b'\x12EiC5TSe5k00'
>>> # removing prefix from prefixed data
>>> remove_prefix(b'\x12EiC5TSe5k00')
EiC5TSe5k00
>>> # get codec used to prefix the prefixed data
>>> get_codec(b'\x12EiC5TSe5k00')
'sha2-256'

Updating the lookup table

Updating the lookup table is done with a script. The source of truth is the multicodec default table. Update the table with running:

$ curl -X GET https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv | ./tools/update-table.py

py-multicodec's People

Contributors

andrepassoslighting avatar dependabot[bot] avatar dhruvbaldawa avatar filips123 avatar rvagg avatar timoglastra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-multicodec's Issues

Private range

With multiformats/multicodec#191 merged, it is now possible to use private ranges with multicodec.

Can this library support private ranges?

I think this would mean being able to register additional custom types which will be allocated into the private range. And then being able to add the multicodec for the private keys.

Continued support?

Hey @multiformats/python-team. We've been archiving various repos in the multiformats and ipld orgs that don't have active, trusted maintainers. Mostly these are implementations in languages that aren't actively used or maintained by Protocol Labs staff, i.e. JavaScript and Go. The major problem we have is pull requests and issues collecting dust and not even being responded to, which is not fair on users and contributors. It's best to send a clear signal that a repository is not actively maintained and if someone wishes to continue the work they should fork and announce.

@snarfed is currently proposing a Python-specific page for ipld.io where we have details of implementations that peopel can use @ ipld/ipld#280 but it lists multiformats/ repos. Before I suggest that we remove the multiformats org section, just recommending https://github.com/hashberg-io/multiformats/ as the go-to Python implementation, I wanted to check in with folks on this team to see if anyone's still active and is willing to continue maintaining these libraries. Otherwise, I'll suggest we remove that section and I'll move to archive these repos with a notice on their README. Note that archival doesn't mean they will never be unarchived if we have renewed interest at some point in the future, but I think it's better if implementations are maintained in orgs where the maintainers have full freedom and autonomy and we can just make sure to keep links to those implementations for users.

Multibase encodings incorrect.

Copied from multiformats/js-multicodec#29

Multibase is concerned with symbols, not byte values. That is, the symbol 'f' mean hexadecimal, regardless of the underlying byte/bit sequence (if any) that happens to encode this symbol. For example, 'f' is still the hex multibase prefix even when written on paper.

base1, base2, base8, and base10 are for text. That is, 011010100 is multibase-encoded base2.

So, it's probably best to just remove these from this table (as this table is otherwise concerned with byte sequences).

Requirements are too specific

Your requirements are too specific for a library, and they've broken my dependency resolution. You require six==1.10.0, for example, which is way too restrictive for a library. Another one of my dependencies made the similar mistake of mandating six==1.11.0, so now I have to choose if i want to use your projects or that one.

You should be using >= instead, or at least >=1.10.0,<2.0.0.

Add more key codecs

  • python-multicodec version: 0.2.1

Currently only ed25519-pub is supported. Could p256-pub, p384-pub, p521-pub be added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.