Skip to main content

BuildLink CoverageLink LicenseLink IssuesLink

Library to partialy hash files.

Installation

pip install partialhash

Usage

# from examples/usage.py
import binascii
import partialhash

path = "examples/random.data"

# sha256 hash of full file
digest = partialhash.compute(path)  # file path or file like object
print(binascii.hexlify(digest))

# sha256 hash of first 1024 bytes
digest = partialhash.compute(path, length=1024)
print(binascii.hexlify(digest))

# sha256 hash, skipping the first 512 bytes
digest = partialhash.compute(path, offset=512)
print(binascii.hexlify(digest))

# sha256 hash of seed + file data
digest = partialhash.compute(path, seed=b'seeddata')
print(binascii.hexlify(digest))

# sha256 hash of 256 byte sample with given seed
# which data is sampled depends on given seed
digest = partialhash.sample(path, 256, seed=b'seeddata')
print(binascii.hexlify(digest))

# sha256 hash of three 256 byte samples with given seed
# sample data will not overlap until sample size exceeds file size
digest = partialhash.sample(path, 256, sample_count=3, seed=b'seeddata')
print(binascii.hexlify(digest))

Metadata

Release files for partialhash 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for partialhash 1.1.3
File Size Uploaded Provenance
partialhash-1.1.3.tar.gz 4.5 kB Without provenance Details

Release files / partialhash-1.1.3.tar.gz

Download URL partialhash-1.1.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
450c5ab46fc29f8800408857a03a554713103581d384796f6a79528417971cfb
BLAKE2b-256 checksum
How to use checksums
b96a993000528a32fabee9d2d9076e6c74c5940775bbcdc55093f45f27a56f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for partialhash 1.1.3

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.

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