Skip to main content
``fileshash``
============

.. image:: https://img.shields.io/pypi/v/fileshash.svg
:target: https://pypi.python.org/pypi/fileshash

.. image:: https://img.shields.io/travis/mmore500/fileshash.svg
:target: https://travis-ci.org/mmore500/fileshash

Python module to facilitate calculating the hash of multiple files.
Tested against Python 2.7, Python 3.6, PyPy 2.7 and PyPy 3.5.
Currently supports `Adler-32 <https://en.wikipedia.org/wiki/Adler-32>`_, `CRC32 <https://en.wikipedia.org/wiki/Cyclic_redundancy_check>`_, `MD5 <https://en.wikipedia.org/wiki/MD5>`_, `SHA-1 <https://en.wikipedia.org/wiki/SHA-1>`_, `SHA-256 and SHA-512 <https://en.wikipedia.org/wiki/SHA-2>`_, and `xxHash-32 and xxHash-64 <https://xxhash.com>`_.

Forked from Leonides T. Saguisag Jr.'s `FileHash <https://github.com/leonidessaguisagjr/filehash>`_.

``FilesHash`` class
------------------

The ``FilesHash`` class wraps around the ``hashlib`` (provides hashing for MD5, SHA-1, SHA-256 and SHA-512) and ``zlib`` (provides checksums for Adler-32 and CRC32) modules and contains the following methods:

- ``hash_file(filename)`` - Calculate the file hash for a single file. Returns a string with the hex digest.
- ``cathash_files(filenames)`` - TODO
- ``hophash_files(filenames)`` - TODO

The ``FileHash`` constructor has two optional arguments:

- ``hash_algorithm='sha256'`` - Specifies the hashing algorithm to use.
See ``filehash.SUPPORTED_ALGORITHMS`` for the list of supported hash / checksum algorithms.
Defaults to SHA256.
- ``chunk_size=262144`` - Integer specifying the chunk size to use (in bytes) when reading the file.
This comes in useful when processing very large files to avoid having to read the entire file into memory all at once. Default chunk size is 262144 bytes.

Example usage
-------------

The library can be used as follows::

>>> import os
>>> from fileshash import FilesHash
>>> TODO


``fileshash`` command line tool
---------------------------------

A command-line tool called ``fileshash`` is also included with the ``fileshash`` package.
Here is an example of how the tool can be used::

$ TODO

Run the tool without any parameters or with the ``-h`` / ``--help`` switch to get a usage screen.

License
-------

This is released under an MIT license.
See the ``LICENSE`` file in this repository for more information.


Metadata

Release files for fileshash 0.1.1

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

Source distribution (sdist)

Source distribution for fileshash 0.1.1
File Size Uploaded
fileshash-0.1.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fileshash 0.1.1
File Interpreter ABI Platform
fileshash-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / fileshash-0.1.1.tar.gz

Download URL fileshash-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9c4855728f441003ae475864535faa6c112481382af49de8c0f24c9ebd3d1491
BLAKE2b-256 checksum
How to use checksums
c44c191fc06f8204c6dfeaa7324d84c9cbc935e86bf682860fdb9582b0eb08c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release files / fileshash-0.1.1-py3-none-any.whl

Download URL fileshash-0.1.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b945af6e4d8e8d862ecae7a45187942ba403d8655c3cd32574d53905463af11f
BLAKE2b-256 checksum
How to use checksums
6a84559aa131d4ca74e40188af8c85491d0ee94dbda05015c638ca87f6421379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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