Check the MD5 of the specified file
@param targetMD5 Expected MD5
@param file      File to check
@return          True if MD5 matches, false otherwise
337523
public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
        InputStream in = FileUtils.openInputStream(file);
        String trueMd5 = DigestUtils.md5Hex(in);
        IOUtils.closeQuietly(in);
        return (targetMD5.equals(trueMd5));
    }
402135
public static boolean writeString(String inputString, File targetFile) {
        if (!targetFile.exists()) {
            try {
                Files.write(targetFile.toPath(), inputString.getBytes());
            } catch (IOException e) {
                return JMExceptionManager.handleExceptionAndReturnFalse(log, e,
                        "writeString", inputString, targetFile);
            }
        }
        return true;
    }
484101
public function is_installed_lang($lang, $md5check) {
        global $CFG;
        $md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
        if (file_exists($md5file)) {
            return (file_get_contents($md5file) == $md5check);
        }
        return false;
    }
1207927
def compare_md5(self):
        """"""
        if self.direction == "put":
            remote_md5 = self.remote_md5()
            return self.source_md5 == remote_md5
        elif self.direction == "get":
            local_md5 = self.file_md5(self.dest_file)
            return self.source_md5 == local_md5
1324608
public static String getMD5Checksum(String text) {
        final byte[] data = stringToBytes(text);
        return getChecksum(MD5, data);
    }
670081
public static String md5File(String filePath) {
        File file = StringKit.isBlank(filePath) ? null : new File(filePath);
        return md5File(file);
    }
485438
def _md5_validation(self) -> bool:
        '''
        
        '''
        fn = self.file if self.compressed_file is None else self.compressed_file

        md5 = hashlib.md5()
        block_size = 16384
        with fn.open('rb') as f:
            f.seek(-16, 2)
            remaining = f.tell()  # File size minus checksum size
            f.seek(0)
            while (remaining > block_size):
                data = f.read(block_size)
                remaining = remaining - block_size
                md5.update(data)

            if (remaining > 0):
                data = f.read(remaining)
                md5.update(data)

            existing_md5 = f.read(16).hex()

        return md5.hexdigest() == existing_md5
357528
function md5(files) {
		var hash = crypto.createHash('md5');
		_.each(files, function(file) {
			if (!isExternal(file))
				hash.update(grunt.file.read(file), 'utf-8');
		});
    	return hash.digest('hex');
	}
1534
def md5(source):
    
    # fix passing char '+' from source
    source = source.replace("%2B", "+")
    with open(source) as file_to_check:
        data = file_to_check.read()
        return hashlib.md5(data).hexdigest()
46506
def md5_for_file(f, block_size=2 ** 20):
    """"""

    md5 = hashlib.md5()
    try:
        # Guess that f is a FLO.
        f.seek(0)

        return md5_for_stream(f, block_size=block_size)

    except AttributeError:
        # Nope, not a FLO. Maybe string?

        file_name = f
        with open(file_name, 'rb') as f:
            return md5_for_file(f, block_size)
1263911
def get_md5_for_file(file):
    
    md5 = hashlib.md5()

    while True:
        data = file.read(md5.block_size)

        if not data:
            break

        md5.update(data)

    return md5.hexdigest()
199462
protected boolean isRelevant(String file) {
        if (mExcludes != null && mExcludes.matcher(file).find()) {
            return false;
        }
        if (mIncludes != null && !mIncludes.matcher(file).find()) {
            return false;
        }
        return true;
    }
659291
def md5_for_file(f, block_size=2 ** 20):
    """"""
    import hashlib

    md5 = hashlib.md5()
    try:
        # Guess that f is a FLO.
        f.seek(0)

        while True:
            data = f.read(block_size)
            if not data:
                break
            md5.update(data)
        return md5.hexdigest()

    except AttributeError as e:
        # Nope, not a FLO. Maybe string?

        file_name = f
        with open(file_name, 'rb') as f:
            return md5_for_file(f, block_size)
857020
public static void saveMD5File(File dataFile, MD5Hash digest)
      throws IOException {
    File md5File = getDigestFileForFile(dataFile);
    String digestString = StringUtils.byteToHexString(
        digest.getDigest());
    String md5Line = digestString + " *" + dataFile.getName() + "\n";
    
    AtomicFileOutputStream afos = new AtomicFileOutputStream(md5File);
    afos.write(md5Line.getBytes());
    afos.close();
    LOG.info("Saved MD5 " + digest + " to " + md5File);
  }
69897
@Pure
	public static boolean isDbaseFile(File file) {
		return FileType.isContentType(
				file,
				MimeName.MIME_DBASE_FILE.getMimeConstant());
	}
161233
public static String getMD5Checksum(InputStream is) throws IOException {

		byte[] digest = null;
		try {
			MessageDigest md = MessageDigest.getInstance(JawrConstant.MD5_ALGORITHM);
			InputStream digestIs = new DigestInputStream(is, md);
			// read stream to EOF as normal...
			while (digestIs.read() != -1) {

			}
			digest = md.digest();
		} catch (NoSuchAlgorithmException e) {
			throw new BundlingProcessException("MD5 algorithm needs to be installed", e);
		}

		return new BigInteger(1, digest).toString(16);
	}
864429
public static boolean isPemFormat(final File file) throws IOException
	{
		boolean result = false;
		final byte[] keyBytes = Files.readAllBytes(file.toPath());
		final String privateKeyPem = new String(keyBytes);
		if (privateKeyPem.indexOf(BEGIN_PRIVATE_KEY_PREFIX) != -1)
		{
			result = true;
			return result;
		}
		if (privateKeyPem.indexOf(BEGIN_RSA_PRIVATE_KEY_PREFIX) != -1)
		{
			result = true;
			return result;
		}
		return result;
	}