Library to partialy hash files.
Project description
Library to partialy hash files.
Installation
pip install partialhash
Usage
import binascii
import partialhash
path = "examples/random.data"
# sha256 hash of full file
digest = partialhash.compute(path)
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))
# recursivly compute sha256 hash until scatter reaches zero
# uses digest to deterministically get next offset and seed value
digest = partialhash.compute(path, length=1024, scatter=4)
print(binascii.hexlify(digest))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
partialhash-1.0.0.tar.gz
(3.5 kB
view hashes)