def digest_file(infile, checksum='md5'):
 if (not __salt__['file.file_exists'](infile)):
  raise salt.exceptions.CommandExecutionError("File path '{0}' not found.".format(infile))
 with open(infile, 'rb') as f:
  file_hash = __salt__['hashutil.digest'](f.read(), checksum)
 return file_hash

def digest_file ( infile , checksum = 'md5' ) : if ( not __salt__ [ 'file.file_exists' ] ( infile ) ) : raise salt . exceptions . CommandExecutionError ( "File path '{0}' not found." . format ( infile ) ) with open ( infile , 'rb' ) as f : file_hash = __salt__ [ 'hashutil.digest' ] ( f . read ( ) , checksum ) return file_hash
return a checksum digest for a file infile a file path checksum : md5 the hashing algorithm to use to generate checksums .