Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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)
Release History

Release History

This version
History Node

1.0.2

History Node

1.0.1

History Node

1.0

History Node

1.0pre

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
TreeHash-1.0.2.tar.gz (1.9 kB) Copy SHA256 Checksum SHA256 Source Oct 3, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting