Skip to main content

Tree Hash Calculator

Project description

Calculates a SHA256 (or, potentially, any other hashlib supported function) “tree” hash, as used by e.g. Amazon Glacier.

Command line usage:

$ treehash <filename> ...

As a library, we follow the hashlib conventions. That is:

>>> from treehash import TreeHash
>>> treehash = TreeHash()
>>> treehash.update(b"Nobody inspects")
>>> treehash.update(b" the spammish repetition")
>>> treehash.digest()
'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06'
>>> treehash.hexdigest()
'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'

Note that it is possible to specify the block size (Glacier uses 1 MB) and hash algorithm used:

>>> treehash = TreeHash(algo=hashlib.md5, block_size=2048*2048)

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

TreeHash-1.0.1.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file TreeHash-1.0.1.tar.gz.

File metadata

  • Download URL: TreeHash-1.0.1.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for TreeHash-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c28a8721e1e539b049161aadedd70985e0e60c349f25123a67ee12f746977279
MD5 f51e8d568d8b6032177ccd77ff8ab600
BLAKE2b-256 8e84a92156c2af36159bc690814eaf6b1f338eb9c3ae54f7b9b3dc36079299f1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page