Skip to main content

sdigest

CI crates.io PyPI

Fast, tunable sparse digests. sdigest fingerprints a file by hashing its size and a deterministic sample of its content with BLAKE3, instead of every byte. That is often orders of magnitude faster than sha512sum, and enough to tell most non-identical files apart.

$ sdigest -l 0 *.flac
sd1:31457806:0:9f2c…41e7  a.flac
sd1:31457806:0:9f2c…41e7  b.flac
sd1:28011203:0:03ab…c9d0  c.flac
sdigest: 3 files, 85.7 MiB in 0.01 s (8.4 GiB/s); coverage 0%, read 384 KiB (0.437%)

On a 176 GiB audio archive on a USB hard disk, level 0 fingerprinted all 16,167 files in 10 s. On the 911 files that share a size with another file, it found exactly the same possible duplicates as full digests did, which took 412 s.

Interpreting sdigests

An sdigest is evidence that content differs, never proof that it is the same.

  • Different sizes, or the same coverage with different digests: the content differs. This is certain.
  • Equal fingerprints: the content may be identical. Unrelated files almost always differ even at level 0, but small edits that keep the size can fall between samples. Sparse digests are not collision-resistant against deliberate tampering. Confirm with cmp when a false match would be costly.
  • Same size, different coverage: no conclusion, unless both coverages sample the same blocks (may_equal checks this).

Install

cargo install sdigest      # CLI
pip install sdigest        # Python module

Use

sdigest -l 0 FILE...                     # levels 0-9; default 5 (1% coverage)
sdigest -c 2.5 FILE...                   # or an exact coverage percent
find . -type f -print0 | sdigest -0      # names on stdin
sdigest FILE... > sums && sdigest -k sums   # check later, like sha512sum -c
level 0 1 2 3 4 5 6 7 8 9
coverage % 0 0.01 0.03 0.1 0.3 1 3 10 30 100

Level 0 hashes the size plus the first and last 64 KiB. Level 9 hashes everything.

from sdigest import may_equal, sdigest

a = sdigest("a.flac", level=0)  # path
b = sdigest(open("b.flac", "rb"), level=0)  # or any seekable binary file object
may_equal(a, b)  # True, False, or None (not comparable)
let fp = sdigest::digest_path(path, sdigest::Coverage::from_level(0)?)?;

For Rust library use without the CLI dependencies, use default-features = false.

Documentation

Development

cargo test                  # Rust unit and CLI tests
uv run pytest               # builds the Python extension and runs Python tests
prek install                # lint and format on commit (prek run --all-files to run now)

Releases: bump version in Cargo.toml, then push a vX.Y.Z tag. CI publishes the crate and the Python wheels using trusted publishing (no stored tokens).

Metadata

Release files for sdigest 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 sdigest 0.1.0
File Size Uploaded
sdigest-0.1.0.tar.gz 23.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for sdigest 0.1.0
File
sdigest-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
sdigest-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
sdigest-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
sdigest-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
sdigest-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
sdigest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
sdigest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 2.1 MB

Release files / sdigest-0.1.0.tar.gz

Download URL sdigest-0.1.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8aab2ddb9bdac25a6ae5c2899ee5158bac9beefd3a6e450b94606e6ea3c6da48
BLAKE2b-256 checksum
How to use checksums
62a7d3c8aa0a1ed8b144ad237386603aa112321e40d600494f10095a37b014ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL sdigest-0.1.0-cp310-abi3-win_amd64.whl
Size 160.9 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b7736765a4216c2026997a094be717b165496745e0fa37eefdbf1ead98d87059
BLAKE2b-256 checksum
How to use checksums
d3e4297b4f067cad08a3c23e3492b1c6795b06cda45b1cb06e3d63d4feb64f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sdigest-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL sdigest-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 477.0 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c262510ccc3fb74b75a925df5245e2377aaf0f5465a93a3cc032931b48529118
BLAKE2b-256 checksum
How to use checksums
c0555e1ba2790d21fcda01ca48bd0d9e74443efbb01920ed075622e34c2efac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sdigest-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL sdigest-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 434.5 kB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
ea7a89be432f949dcbe8a82da9a2c1ff6ad084e12aa32aa7b22a734527c6dab6
BLAKE2b-256 checksum
How to use checksums
f34dec356dae8a22bf04cb54ed78fe02f3a4d3374ec731496b95e96777de4182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL sdigest-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 265.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
197d3e389109293a2962ccd57e070af1ddb23746c7266bfda1e69990a8c0f251
BLAKE2b-256 checksum
How to use checksums
a62d63fc454a7eb819e3420729479f78ab8872347b4742cadcb3ff9540e32e01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL sdigest-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 257.3 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e6c53407d5e24929ebfd30e71a29281f87a7c24d54a8ea0b54f980831b078add
BLAKE2b-256 checksum
How to use checksums
1ff30997a4de09fdc1df73b484e24fc7c68dc629052bf6d868f6b34a725ecb3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL sdigest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 242.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c98dbe97d88f677e6f60fdb9d624a138060ae40c1328c25271b6ba11af03d955
BLAKE2b-256 checksum
How to use checksums
a7079464613364fbdaee7ad515d554d250b9619b01017d176fbcdcde847148b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL sdigest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 258.9 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e89247fe4efe2cab424a3df17b2f6253e27db03ab1e2b39e7528724d83e0abae
BLAKE2b-256 checksum
How to use checksums
5b8f0602c5d79868026851fe51678ef40c3ac172ae6e06cdf6d402e89236f273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.2

8 release files

0.2.1

8 release files

0.2.0

8 release files

This release

0.1.0 This release

8 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