image_data_hash for Python
Native JPEG ImageDataHash matching ExifTool. Python 3.10+; no runtime dependencies.
Distribution and import name: image_data_hash.
Installation
python3 -m pip install image_data_hash
Usage
from image_data_hash import image_data_hash, image_data_hash_bytes, image_data_hash_stream
digest = image_data_hash("photo.jpg") # MD5 by default
digest = image_data_hash("photo.jpg", algorithm="sha256")
digest = image_data_hash("photo.jpg", algorithm="sha512")
with open("photo.jpg", "rb") as source:
digest = image_data_hash_stream(source, algorithm="sha256")
digest = image_data_hash_bytes(jpeg_bytes, algorithm="sha256")
Names such as MD5, SHA-256 and SHA-512 are accepted. Returns lowercase
hexadecimal. Path calls close their files; stream calls leave caller-owned streams
open. Streams must provide blocking binary reads. Hashing uses bounded working
memory; the buffer helper retains the input in memory. Invalid/truncated JPEGs
raise ValueError; file errors propagate.
Tests
Generate the shared fixtures first, then:
cd image-data-hash-py
uv sync --locked
uv run black --check src tests
uv run pytest -q
Tests compare both file and bytes APIs against ExifTool for all three algorithms, including one-byte reads. See compatibility rules.
Project
Repository: bencevans/image-data-hash. Maintainer: Ben Evans. Licensed under MIT.
Metadata
Release files for image-data-hash 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| image_data_hash-0.1.0.tar.gz | 92.4 kB | Without provenance | Details for image_data_hash-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image_data_hash-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for image_data_hash-0.1.0-py3-none-any.whl |
Total release size: 97.9 kB
Release files / image_data_hash-0.1.0.tar.gz
| Download URL | image_data_hash-0.1.0.tar.gz |
|---|---|
| Size | 92.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edde32889b4312f22f5774fe32c04edc4a7bec4112c1afed9ae2a2968fe46b6f
|
|
BLAKE2b-256 checksum How to use checksums |
449dc52dcab49346dec554ac089952acc564588dd2e7e90549a4ce4690d45471
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / image_data_hash-0.1.0-py3-none-any.whl
| Download URL | image_data_hash-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f74245109e9a8f4498f60d7731c18eecfb5c3d939876bfbd5e108e25f2464148
|
|
BLAKE2b-256 checksum How to use checksums |
51499ca3033491397cd7c76f635b9173da0caa4d6535c99dc4bde9084e55e848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for image-data-hash 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.