sdigest
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
cmpwhen a false match would be costly. - Same size, different coverage: no conclusion, unless both coverages
sample the same blocks (
may_equalchecks 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
doc/design.md: motivation, design, decisions and rationaledoc/sdigest.1: man page (man -l doc/sdigest.1)
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 matching X.Y.Z tag (no v). CI
publishes the crate and the Python wheels using trusted publishing (no
stored tokens).
Metadata
Release files for sdigest 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sdigest-0.2.0.tar.gz | 24.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| sdigest-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| sdigest-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| sdigest-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| sdigest-0.2.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.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| sdigest-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| sdigest-0.2.0-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.0.tar.gz
| Download URL | sdigest-0.2.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
169cc5a41632c67fa03527810515d82ff64d3a82182b0f6aae27d21dc0a8bfa9
|
|
BLAKE2b-256 checksum How to use checksums |
56186602a4a7e4d9f84897127a9764cf91ac816100f96cdccf153618ffe0801f
|
| 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.0-cp310-abi3-win_amd64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 503.3 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c3db228b87dba864c374bc66b09f7f3c575c5139f3a0d9d076d092e22332278a
|
|
BLAKE2b-256 checksum How to use checksums |
2b5c3d0fecee98ac766015001a392a1da71243d13bcd0efab23a511e3b2cbb86
|
| 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.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 820.8 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d36bcb9b478c2aade9cf07e4cf118ed4e1385356630db5b8717e60d48b9594d1
|
|
BLAKE2b-256 checksum How to use checksums |
20a6e3d346aa610d5453907a03d3d2751eacb5bf0dd61a7b8ebebb775b3ad6e9
|
| 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.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 761.2 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
332caec24ffe35a3e5e4360b62dca8436733cfa03c7d443380bd29c7cfc0f20f
|
|
BLAKE2b-256 checksum How to use checksums |
1b8803f669278a2e1826619f7876b257628921b11e640837efe34f8adb2c55b4
|
| 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.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 608.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
77efba02f499f2c389ef05de0dad8181cf01af1ba0e44edee6b88a63d94fd8bb
|
|
BLAKE2b-256 checksum How to use checksums |
57e8abbef42d1df445327cdcfc35688af8d8ef8ac7080db677440981b91a8f42
|
| 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.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | sdigest-0.2.0-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 |
3b961b5b51403ff463e48041e67432b2eef4e995fab605a3f7bea2bec69b6ec7
|
|
BLAKE2b-256 checksum How to use checksums |
730f2482383f36eac1b8e7e62d888cca72dc9000c9e3813072b1230d037f1a50
|
| 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.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 542.6 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
34e549921561e5878f384dba9d96b7d90c7c20c0a92717ce405ff60a8765e006
|
|
BLAKE2b-256 checksum How to use checksums |
fc57e882a354825a38b76a1a540b24076336425a2070d094ac39dbf70fdf5f5b
|
| 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.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | sdigest-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 576.3 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
142c565037bbab0a17f4da5f40bda33199263a3d564b5c7e99742758c3585346
|
|
BLAKE2b-256 checksum How to use checksums |
bb8c371bff0784ff1a0027b7dc8993cdd5d13d5a87f353a7948032f65b7c6ced
|
| 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}
|