Skip to main content

Python IPFS CID

Computes IPFS CIDv0s exposed as a Python module.

This library computes the IPFS DAG of the input data and then returns the CID of the root node. This returns the same CID as would be computed by ipfs add <file>.

This library also computes the hash of the data after it has been converted to the DAG-PB format and processed, primarily for debugging and testing purposes.

Examples

from ipfs_cid_v0 import compute_cid
cid: str = compute_cid(b"1234")  # Returns QmTPqcLhVnCtjoYuCZwPzfXcFrUviiPComTepHfEEaGf7g
from ipfs_cid_v0 import compute_hash
cid_hash: bytes = compute_hash(b"1234") # Returns b'\x12 K\x1b\x80\x9cr\xce\x0e\xf8\xd8\x15\xb9"\xeef\x04/\xc4\xaf\xe5\xc9G\xad\xd2\xa5,\xbcR\xd8\xb0\x19_\xa3'
from ipfs_cid_v0 import compute_hash_hex
cid_hash_hex: str = compute_hash_hex(b"1234") # Returns '12204b1b809c72ce0ef8d815b922ee66042fc4afe5c947add2a52cbc52d8b0195fa3'

Build

You must have rust/cargo installed. Then run:

pip install maturin
maturin develop --release 

Install in your python environment if doesn't automatically get picked up:

python -m pip install ./target/wheels/ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_34_x86_64.whl

Current limitations

  • Only supports CID v0
  • Only supports files, not directories
  • Only supports the default IPFS block size (256 KiB)

Metadata

Release files for ipfs-cid-v0 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for ipfs-cid-v0 0.0.1
File
ipfs_cid_v0-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details
ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
ipfs_cid_v0-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
ipfs_cid_v0-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
ipfs_cid_v0-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 7.0 MB

Release files / ipfs_cid_v0-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
19c57380f53bbc6567dab51d322917364299f762b7b0080b809f96c56048ee42
BLAKE2b-256 checksum
How to use checksums
349ba679116208ab4a1c71bc9ed60080237535ef1db6700979cb80caa95a980e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_34_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
9b5c97ac4afb73c70545d811dd92a74c517e54c4f7877d301ae7c33b13863bdf
BLAKE2b-256 checksum
How to use checksums
81910a6190db86d85264861955207ab0be2b12a94207b7b0d5eac87940ceab48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c6fed1d7dd795025693b3c1aa24214f72a3922ba9a4d21349386b6a3b18dca39
BLAKE2b-256 checksum
How to use checksums
09d400f5a439bd93d4ee7374f53620f07b23ee994d344969aab4d7bf0812b3c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / ipfs_cid_v0-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
617a9a0aee7b6f37b4893d074e62576ada7559793f90ef11c448c2e4e0010285
BLAKE2b-256 checksum
How to use checksums
9e476f33ecc77960c8c540e2209100c717a31a7c53a3105d345e4c78cbfd0bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / ipfs_cid_v0-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c6f94174ae7b78fdf9a9a85c493622b0cb98a91208185a285d872fc4ede8cb0e
BLAKE2b-256 checksum
How to use checksums
d785d76c78c753220b7adbe09e4cf0da9744bb5dc10361d5f960e706434dcf73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / ipfs_cid_v0-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipfs_cid_v0-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
da7527db033edb32c0c3daf9cca9bfb4b3fc1a7bf398171c5cfcc00e46e27a6d
BLAKE2b-256 checksum
How to use checksums
a2504f04cfc5801e0ab73fe81adf1fb45b43001e36876a2c6a5a5d2f21f1357c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page