hash — file hashes

The hash check runs the contents of files through a hashing algorithm, and asserts that the result matches a known hash.


Check that a file has a specific MD5 hash:

path = '/usr/bin/specsheet'
algorithm = 'md5'
hash = '3f22baaf4ba820a800dfc51af5ba1892'

List of parameters

algorithmstringThe hashing algorithm to use.
hashstringThe expected hash, as a string.
pathstringPath to a local file on disk.

List of hashing algorithms

  • md5
  • sha1
  • sha224
  • sha256
  • sha384
  • sha512