hash_distance — IMGFORENSICS hash op

• Data kinds: phash × phash → measurement

• Call: import fullseye as fs; fs.ledger.hash_distance(hash1, hash2) -> 'int' (to call the implementation directly, import imgforensics; imgforensics.hash_distance(hash1, hash2) -> 'int'; from the registry, opsimgforensics.get("hash_distance"))

Usage

Hamming distance between two perceptual hashes (the number of differing bits).

It checks dtype and length and fails closed. If a float 1-D array were accepted and counted with !=, almost certainly "all bits differ" = the maximum distance would come out, a *plausible* value —— but that is a type mix-up, not a difference between images.

The return is a Python int (measurement vocabulary). If you want the distance normalized by the bit length, hash_distance(a, b) / a.size.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• image_forensics_audit — py -3.11 examples/image_forensics_audit.py

Ops the type connects to (they accept measurement as input)

evidence_quantile

Same category (hash)

perceptual_hash


*Provenance: imgforensics.py — IMGFORENSICS operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.