mach.io.utils.file_digest#
- mach.io.utils.file_digest( ) hashlib._Hash#
- Return a digest object that has been updated with contents of file object. - This is a backport-compatible implementation of hashlib.file_digest() that works with Python 3.9+ and follows the same API as Python 3.11+. - Parameters:
- fileobj – File-like object opened for reading in binary mode 
- digest – Hash algorithm name as str, hash constructor, or callable that returns hash object 
 
- Returns:
- Hash object with file contents 
 - Example - with open(“file.bin”, “rb”) as f:
- hash_obj = file_digest(f, “sha256”) print(hash_obj.hexdigest())