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

uvx sdigest FILE...        # run without installing (prebuilt wheels, no Rust needed)
uv tool install sdigest    # install the sdigest command
pip install sdigest        # Python module and command
cargo install sdigest      # build the command from source

The sdigest command is identical however it is installed.

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: push a semver tag, e.g. git tag 1.2.3 && git push --tags (no v; pre-releases look like 1.2.3-rc.1). The tag is the only source of truth for the version: Cargo.toml holds 0.0.0, CI writes the tag into it before building, and CI publishes the crate and the Python wheels using trusted publishing (no stored tokens). Development builds describe themselves relative to the latest tag, e.g. 0.2.1-dev.3+g4b551b3.

Metadata

Release files for sdigest 0.2.1

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.2.1
File Size Uploaded
sdigest-0.2.1.tar.gz 26.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for sdigest 0.2.1
File
sdigest-0.2.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
sdigest-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
sdigest-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
sdigest-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
sdigest-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
sdigest-0.2.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
sdigest-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 4.4 MB

Release files / sdigest-0.2.1.tar.gz

Download URL sdigest-0.2.1.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5d8454dc2659ef214c7febe1dd8b32622aa74aa73292cc727401ea7a34350490
BLAKE2b-256 checksum
How to use checksums
9b8c1009ca81ec958dbf2f96df4fcb26bf0ea579f010a941392f3aecb931d71b
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.2.1-cp310-abi3-win_amd64.whl

Download URL sdigest-0.2.1-cp310-abi3-win_amd64.whl
Size 503.7 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
937753e680e557620d456147566a79c45cebf8b2df3c970db59c1b177a493db4
BLAKE2b-256 checksum
How to use checksums
e5b18b8bc2549d5ed91e0c60f491b89b5b4b51b38cf1e223c1967d8215cf3896
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.2.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL sdigest-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 821.2 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c3977eb55b9d5f3c2d940f13c53aa10be6a5c92176006f2a5f675d0726f74dd8
BLAKE2b-256 checksum
How to use checksums
74413d82d6db498c922805c56b4908b319815bca57825e41685ca4c3d4c17226
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.2.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL sdigest-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 761.5 kB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
2dd7dfc5bbc426db29ff7d3e31f2570685ab23fd379cfd589246930ea1a27648
BLAKE2b-256 checksum
How to use checksums
957f12b26cfb3588e81c348fddeee2f51ec8ed64c94284cd6af08f84881c2933
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.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL sdigest-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 609.0 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b924d00c8eedb1fb47e3a3f45a6ee5e3d665373257ab5e6b08df6a5e4823675f
BLAKE2b-256 checksum
How to use checksums
b77abb6cc1fcbe1771fcfdfc437d3a61dee6a99727f4c4477c8ddb4e60f0a760
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.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL sdigest-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 584.2 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
95ed4122900d206e5e4b861df0a7e472fa0e32fcb4311dda6a6d3b6d44fa17e0
BLAKE2b-256 checksum
How to use checksums
29de9ae53523fffaf12831953946059308b1a7b56c026da34a8f34d6c5083ecd
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.2.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL sdigest-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Size 543.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0997302596482511a9eae6f9bc0bfbe5be56b647a2146064df4c79861616d179
BLAKE2b-256 checksum
How to use checksums
dc78919169dbcd30924de63ab85c664f6746db3b5b297b05720fd270e4e6825e
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.2.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL sdigest-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 576.7 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
75145114298dc897cc351b0b3cc48b06d3d5b7f893517d3ca213a24aeed184b3
BLAKE2b-256 checksum
How to use checksums
76e006f3d5a57be17bd3e528052d8c130a2929ddf8381fe84c4e0916a0d1be1d
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

This release

0.2.1 This release

8 release files

0.2.0

8 release files

0.1.0

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