Self-describing content-addressed identifiers for distributed systems
Project description
CID (Content IDentifier)
What is CID ?
CID is a format for referencing content in distributed information systems, like IPFS. It leverages content addressing, cryptographic hashing, and self-describing formats.
It is the core identifier used by IPFS and IPLD.
CID is a self-describing content-addressed identifier.
It uses cryptographic hashes to achieve content addressing.
It uses several multiformats to achieve flexible self-description, namely multihash for hashes, multicodec for data content types, and multibase to encode the CID itself into strings.
Sample Usage
>>> from multiformats_cid import make_cid
>>> make_cid('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')
CIDv0(version=0, codec=dag-pb, multihash=b"\x12 \xb9M'\xb9\x93M>\x08\xa5.R\xd7\xda}\xab\xfa\xc4\x84..")
>>> cid = make_cid('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')
>>> print(cid.version, cid.codec, cid.multihash)
>>> print(cid.encode())
QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4
>>> str(cid)
'QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'
Installation
Stable release
To install py-multiformats-cid, run this command in your terminal:
$ pip install py-multiformats-cid
This is the preferred method to install CID, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources
The sources for py-multiformats-cid can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone https://github.com/pinnaculum/py-multiformats-cid
Or download the tarball:
$ curl -OL https://github.com/pinnaculum/py-multiformats-cid/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Other info
Free software: MIT license
Documentation: https://py-multiformats-cid.readthedocs.io.
Python versions: 3.7, 3.8, 3.9, 3.10
History
0.4.4 (2022-11-23)
py.typed in package_data
0.4.3 (2022-11-19)
Add typing hints: contribution from @bh2smith
Add CI workflow
0.4.2 (2022-10-31)
Transition release to make mypy happy
0.4.0 (2022-10-31)
Rename py-cid to py-multiformats-cid (@pinnaculum)
remove crazy version range limits for dependencies which cause major headaches for downstream projects with multiple confluent indirect dependencies on this library
0.2.1 (2018-10-20)
Fix edge cases with multibase and multihash decoding
Added hypothesis tests while verifying CIDs
0.1.5 (2018-10-12)
Handle the case where an incorrect base58 encoded value is provided to make_cid
0.1.0 (2017-09-05)
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 Distributions
Built Distribution
Hashes for py_multiformats_cid-0.4.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83f6c3109ed56664799c7367703a68d1724b1e9bd79b45c8935c77660560d1dd |
|
MD5 | 36cd814f765cbb3bab64f79654624a1e |
|
BLAKE2b-256 | 1a27aa30afa228aedb4789e500700f81798a03322d11f377af4e9e282b1fc6f6 |