def hash_file(path, hashobj, conn=None):
    if os.path.isdir(path):
        return ''

    with salt.utils.fopen(path, 'r') as f:
        hashobj.update(f.read())
        return hashobj.hexdigest()
Get the hexdigest hash value of a file
dataset/ETHPy150Open saltstack/salt/salt/spm/pkgfiles/local.py/hash_file