Skip to main content

aleph-cid (Python)

kubo-compatible IPFS CID computation for Aleph Cloud, backed by the aleph-cid Rust crate. Computes the exact CIDs that kubo would assign, without running an IPFS node: streaming file hashing (CIDv0 and CIDv1), UnixFS folder DAGs (plain and HAMT-sharded directories), and CARv1 packing.

All hashing releases the GIL, so it can run on worker threads without blocking the interpreter.

Install

pip install aleph-cid

Prebuilt abi3 wheels cover CPython 3.10+ on Linux (x86_64, aarch64), macOS, and Windows.

Usage

import aleph_cid

# One-shot CIDv0 (kubo `ipfs add` default)
aleph_cid.compute_cid(b"hello\n")

# Streaming, for large files
hasher = aleph_cid.CidHasher.for_ipfs_v1_raw_leaves()
with open("video.mp4", "rb") as f:
    while chunk := f.read(1 << 20):
        hasher.update(chunk)
cid = hasher.finalize()

# Verify data against an existing CID of any supported flavor
hasher = aleph_cid.CidHasher.for_expected(cid)
hasher.update(data)
assert hasher.finalize() == cid

# Folder root CID, matching kubo `/api/v0/add?wrap-with-directory=true`
root = aleph_cid.hash_folder("./site", cid_version=1)

# Pack a folder into a CARv1 file (for `/api/v0/ipfs/add_car` uploads)
root = aleph_cid.write_folder_car("./site", "site.car")
assert aleph_cid.read_carv1_root("site.car") == root

Compatibility

CIDs match kubo defaults: sha2-256, 256 KiB chunks, balanced DAGs with 174 links per node, dag-pb leaves for CIDv0 and raw leaves for CIDv1, directories HAMT-sharded above 256 KiB of link data. Golden tests pin the output against real kubo.

Development

Built with maturin:

cd crates/aleph-cid-python
python -m venv .venv && . .venv/bin/activate
pip install maturin pytest
maturin develop
pytest

Release files for aleph-cid 0.1.0

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

Source distribution (sdist)

Source distribution for aleph-cid 0.1.0
File Size Uploaded
aleph_cid-0.1.0.tar.gz 43.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for aleph-cid 0.1.0
File
aleph_cid-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
aleph_cid-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
aleph_cid-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 1.9 MB

Release files / aleph_cid-0.1.0.tar.gz

Download URL aleph_cid-0.1.0.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eb0d09993d0b1be952476d37733d3dbdc84e0a3ec4b0e6724b88094f3af8392c
BLAKE2b-256 checksum
How to use checksums
ec70379acea18f6f7c47416da3f378258cdc54ff7c7a3e29e5b25377c6260d58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / aleph_cid-0.1.0-cp310-abi3-win_amd64.whl

Download URL aleph_cid-0.1.0-cp310-abi3-win_amd64.whl
Size 273.0 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d272b9aeb27f48cbc418f6d1de4b290f1f315c512b08d8d00992e913a711a336
BLAKE2b-256 checksum
How to use checksums
5581abfd7a06b97f74efe58832b242a8e7449a41f4c9a7060d39297991268caa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 420.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d76c797bae94937f9887f9c6da02b1cd25295908daa82fbed15284db3209c66d
BLAKE2b-256 checksum
How to use checksums
607168347f03ddcb5806b241ee74367ad96db96866581278a091be00aef379fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL aleph_cid-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 411.7 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5319cb11317ac2b6ff7d41ece9ee0679653aab1035a5c4a3a0ec02dddf6cf28b
BLAKE2b-256 checksum
How to use checksums
47a7b675a113cf20a13d5a4dd6b4f29db6e8e6f34861fd0f7d4633bb8c7bc50d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / aleph_cid-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL aleph_cid-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 366.2 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d4a5e6b5e4b8308fe69e48d9abfd58a025af859aff1d17f986fd44504f267288
BLAKE2b-256 checksum
How to use checksums
396ca8e96cd891f664f6c095e17fa1bd0ec4f41c42086910471193b1a8125133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / aleph_cid-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL aleph_cid-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 376.2 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8022fe25c40cbe30320f06cb16c946cfb6f58a436c8a7e529fcb4255dae21a0f
BLAKE2b-256 checksum
How to use checksums
b187403dd50631dcc7e72b05886070faa80da4c7e2d120628c7be93bfbe0ff8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 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