Skip to main content

rriblt

Rateless Invertible Bloom Lookup Tables for Python, implemented in Rust via PyO3.

Two machines each hold a large set, and they want to learn exactly which items differ. rriblt does this with communication proportional to the size of the difference, not the size of the sets, and neither side has to know or estimate that difference in advance.

It implements Yang, Gilad & Alizadeh, Practical Rateless Set Reconciliation (SIGCOMM 2024). As far as I can tell, this is the first Python implementation. The authors' reference implementation is in Go.

Install

pip install rriblt

Usage

The sender (Alice) streams coded symbols. The receiver (Bob) feeds them to a decoder until it reports success, then tells Alice to stop.

from rriblt import Encoder, Decoder

SIZE = 16  # every symbol is exactly SIZE bytes

# Alice
enc = Encoder(SIZE)
enc.add_many(alice_symbols)          # iterable of bytes, or one flat buffer

# Bob
dec = Decoder(SIZE)
dec.add_many(bob_symbols)

while not dec.decoded:
    chunk = enc.produce(64)          # 64 coded symbols, `64 * enc.cell_size` bytes
    dec.add_coded(chunk)             # ...sent over the network in real life

dec.remote_only()   # list[bytes]: Alice has these, Bob doesn't
dec.local_only()    # list[bytes]: Bob has these, Alice doesn't

Variable-size records

Symbols have a fixed size. To reconcile rows, files, or other records, reconcile their digests and keep a local map back to the records:

from rriblt import digest  # BLAKE2b, 16 bytes by default

by_digest = {digest(row): row for row in my_rows}
dec.add_many(by_digest)
...
missing_here = dec.remote_only()           # digests to fetch from the peer
extra_here = [by_digest[d] for d in dec.local_only()]

Integers can be encoded directly, e.g. x.to_bytes(8, "little") with symbol_size=8. A numpy uint64 array can be passed straight to add_many as a flat buffer.

Fixed-size sketches

When you'd rather compute a one-shot summary (for example, to store with each replica), use Sketch. Sketches support add, remove, and subtraction:

from rriblt import Sketch

a = Sketch(16, num_cells=1000); a.add_many(set_a)
b = Sketch(16, num_cells=1000); b.add_many(set_b)
only_a, only_b = (a - b).decode()   # ValueError if the difference is too big

Sketch.to_bytes() is byte-identical to the first num_cells symbols an Encoder would produce for the same set. A stored sketch can therefore be fed to a Decoder as the start of a stream, and the encoder can continue from there if more cells are needed.

Benchmarks

16-byte symbols (32-byte cells). Each party loads its set from a flat buffer, then cells are streamed in batches of d/20 until decoding succeeds. Single thread. Source: benchmarks/bench.py.

set size difference d load (both sides) reconcile cells sent bytes sent vs. sending every digest
100,000 10 0.01s 0.15s 24 (2.4x d) 0.8 kB 2,083x less
100,000 1,000 0.01s 0.38s 1,400 (1.40x d) 44.8 kB 36x less
1,000,000 100 0.08s 3.9s 135 (1.35x d) 4.3 kB 3,704x less
1,000,000 10,000 0.07s 6.7s 14,000 (1.40x d) 448 kB 36x less

The number of cells converges to the paper's ≈1.35x the difference. For very small differences the constant is larger, and batching adds some overshoot. Reconcile time is dominated by applying each local symbol to the ~2·ln(cells) cells it maps to. The paper's own measurements show the same trade-off: very little bandwidth, in exchange for CPU proportional to set size × log(difference).

How it works

Every symbol s is XOR-ed into an infinite sequence of cells: cell 0 always, and cell i with probability 1/(1+i/2), at indices determined by hash(s). Each cell stores (xor of symbols, count, xor of hashes). Subtracting Bob's cells from Alice's leaves a sketch of the symmetric difference. That sketch is peeled: a cell with count ±1 whose stored hash matches the hash of its sum holds exactly one symbol, which is removed everywhere it appears, and that can expose more pure cells. Because the sequence is infinite, Alice just keeps sending until Bob succeeds.

Implementation notes:

  • The index mapping follows the authors' Go randomMapping.nextIndex, except that the step is clamped to at least 1. The Go code can produce a zero step (with probability about 2^-31 per step), which maps a symbol into the same cell twice.
  • The hash is xxh3_64 with a configurable seed, and both sides must use the same seed. Pick a secret random seed if adversaries could choose your set elements, since crafted collisions can stall decoding.
  • Wire format per cell: sum[symbol_size] | count: i64 LE | hash: u64 LE. It is not compatible with the Go library's encoding.
  • Encoder.add raises after produce has been called, because symbols added late would be missing from cells already sent. The Go version accepts them silently. Decoder.add can be called at any time.
  • Encoding is batched: each produce(n) / add_coded(...) call does one heap operation per symbol touching that block of cells, not one per cell.

Development

cargo test --no-default-features
pip install -e '.[dev]' && maturin develop --release
pytest
python benchmarks/bench.py

Metadata

Release files for rriblt 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 rriblt 0.1.0
File Size Uploaded Provenance Actions
rriblt-0.1.0.tar.gz 20.4 kB With provenance Details for rriblt-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rriblt 0.1.0
File Actions
rriblt-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for rriblt-0.1.0-cp311-abi3-win_amd64.whl
rriblt-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for rriblt-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rriblt-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for rriblt-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rriblt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for rriblt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
rriblt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for rriblt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 1.2 MB

Release files / rriblt-0.1.0.tar.gz

Download URL rriblt-0.1.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
518ad16fd740b533260481665c934503c4f4bc1914e1a609db589cfd1e4920d4
BLAKE2b-256 checksum
How to use checksums
493f62feadc24523fca5b1dad85cd6ba343e7c5e1087c8c15d8258cd69ce47f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / rriblt-0.1.0-cp311-abi3-win_amd64.whl

Download URL rriblt-0.1.0-cp311-abi3-win_amd64.whl
Size 158.5 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ec255e955ede08a86911169a7bbccee7bdf668d896bd185b98dcf89d9045937a
BLAKE2b-256 checksum
How to use checksums
2642e0eeec8c09ad402a782c03dcf594b36f0e3540af8b4f2b70e0ffa9728147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / rriblt-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rriblt-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 267.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
124905913a8fc7d038087854baa6ed412081f6e6b9fc6a9f65f532f0929e334a
BLAKE2b-256 checksum
How to use checksums
6760858318bc010e88c765019d33e4930484118c15fcac6288dc845814f7bb73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / rriblt-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rriblt-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 266.3 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
05ab63bd5d2f2f33930114678b8c46ce17352800152fafd28735f2926a032a14
BLAKE2b-256 checksum
How to use checksums
62e0279591a444026db78dce2de8e0dfeb27ef937d0945d36c61b40e68efe5c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / rriblt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL rriblt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 247.1 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3f50d1cdd0c8e5b0509305df67c3cc411766de8c5426f854330f8ff7664a2e6c
BLAKE2b-256 checksum
How to use checksums
da5ae4c11a535225c709951b1548fc6e56f01fcd6d6c88b43402dbadf5c7316b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / rriblt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL rriblt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 252.3 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9752a767001c9b7f1f0171e10007fcc1c1943ef274479d51d675bb90e806a761
BLAKE2b-256 checksum
How to use checksums
511d4ac4c658294bc54afa9845c1eaea5977e19774c0046cf781cd65da5a4789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Security for rriblt 0.1.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for rriblt-0.1.0.tar.gz

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 Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

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