code: def hash_file(filename):
      
      hasher = hashlib.sha1()
      with open(filename, 'rb') as f:
          buf = f.read(65536)
          while len(buf) > 0:
              hasher.update(buf)
              buf = f.read(65536)
  
      return hasher.hexdigest()
docs: Generate a hash for the contents of a file