Skip to content

rsgalloway/hashio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashio

Custom file and directory checksum tool.

Features

  • multiple hash algos: c4, md5, sha256, sha512, xxh64
  • recursively runs checksums on files in directory trees
  • ignores predefined file name patterns
  • caches results for better performance

Installation

The easiest way to install:

$ pip install -U hashio

Usage

Checksum one or more files or directories using one or more hash algorithms (default is xxh64):

$ hashio <PATH> [--algo <ALGO>]

Recursively checksum and gather metadata all the files in a dir tree, and output results to a JSON file:

$ hashio <DIR>

Note that files matching patterns defined in config.IGNORABLE will be skipped.

Verify paths in previously generated JSON file by comparing stored mtimes (if available) or regenerated hash values if mtimes are missing or different:

$ hashio --verify hash.json

Environments

You modifiy settings in the environment stack file hashio.env, or create a new environment stack:

$ cp hashio.env debug.env
$ vi debug.env  # make edits
$ ./debug.env -- hashio

Python API

Generate a hash.json file for a given path (Default is the current working directory):

from hashio.worker import HashWorker
worker = HashWorker(path)
worker.run()

Verify pre-generated checksums stored in a hash.json file:

from hashio.encoder import verify_checksums
for algo, value, miss in verify_checksums("hash.json"):
    print("{0} {1}".format(algo, miss))