@Override public byte[] getBytes() { if (md5 != null) { return md5.getDigest(); } return new byte[0]; } }
@Override public int getLength() { if (md5 != null) { return md5.getDigest().length; } return 0; }
/** * Save the ".md5" file that lists the md5sum of another file. * @param dataFile the original file whose md5 was computed * @param digest the computed digest * @throws IOException */ public static void saveMD5File(File dataFile, MD5Hash digest) throws IOException { final String digestString = StringUtils.byteToHexString(digest.getDigest()); saveMD5File(dataFile, digestString); }
private void computeMd5Crc() throws IOException { MD5Hash md5out; if (isPartialBlk() && getCrcPerBlock() > 0) { md5out = checksumPartialBlock(); } else { md5out = checksumWholeBlock(); } setOutBytes(md5out.getDigest()); LOG.debug("block={}, bytesPerCRC={}, crcPerBlock={}, md5out={}", getBlock(), getBytesPerCRC(), getCrcPerBlock(), md5out); }
contentMeta.add(Nutch.SEGMENT_NAME_KEY, segName); contentMeta.add(Nutch.SIGNATURE_KEY, StringUtil.toHexString(MD5Hash.digest(txtContent[0].getBytes()).getDigest()));
case MD5CRC: MD5Hash md5out = MD5Hash.digest(blockChecksumBuf.getData()); setOutBytes(md5out.getDigest()); break; case COMPOSITE_CRC:
@Override public int getLength() { if (md5 != null) { return md5.getDigest().length; } return 0; }
@Override public byte[] getBytes() { if (md5 != null) { return md5.getDigest(); } return new byte[0]; } }
/** * Write checksum for image file. Pulled from MD5Utils/internals. Awkward to * reuse existing tools/utils. */ void writeMD5(String imagename) throws IOException { if (null == outdir) { return; } MD5Hash md5 = new MD5Hash(digest.digest()); String digestString = StringUtils.byteToHexString(md5.getDigest()); Path chk = new Path(outdir, imagename + ".md5"); try (OutputStream out = outfs.create(chk)) { String md5Line = digestString + " *" + imagename + "\n"; out.write(md5Line.getBytes(Charsets.UTF_8)); } }
/** * Save the ".md5" file that lists the md5sum of another file. * @param dataFile the original file whose md5 was computed * @param digest the computed digest * @throws IOException */ public static void saveMD5File(File dataFile, MD5Hash digest) throws IOException { final String digestString = StringUtils.byteToHexString(digest.getDigest()); saveMD5File(dataFile, digestString); }
/** * Save the ".md5" file that lists the md5sum of another file. * @param dataFile the original file whose md5 was computed * @param digest the computed digest * @throws IOException */ public static void saveMD5File(File dataFile, MD5Hash digest) throws IOException { final String digestString = StringUtils.byteToHexString(digest.getDigest()); saveMD5File(dataFile, digestString); }
public void map(Key row, Value data, Context context) throws IOException, InterruptedException { Mutation m = new Mutation(row.getRow()); m.put(new Text("cf-HASHTYPE"), new Text("cq-MD5BASE64"), new Value(Base64.encodeBase64(MD5Hash.digest(data.toString()).getDigest()))); context.write(null, m); context.progress(); }
byte[] bytes = md5.getDigest(); bytes[0] += 1; md5 = new MD5Hash(bytes);
.setBytesPerCrc(bytesPerCRC) .setCrcPerBlock(crcPerBlock) .setMd5(ByteString.copyFrom(md5.getDigest())) .setCrcType(PBHelper.convert(checksum.getChecksumType()))) .build()
.setBytesPerCrc(bytesPerCRC) .setCrcPerBlock(crcPerBlock) .setMd5(ByteString.copyFrom(md5.getDigest())) .setCrcType(PBHelper.convert(checksum.getChecksumType()))) .build()