/** * Returns the value of the CRC32 as a hex string. */ public String getCRC32 () { return padLeadingZeroes (Long.toHexString (_crc32.getValue ()), 8); }
/** * Returns the value of the MD5 digest as a hex string. * Returns null if the digest is not available. */ public String getMD5 () { String value = null; if (_md5 != null) { StringBuffer buffer = new StringBuffer (); byte [] digest = _md5.digest (); for (int i=0; i<digest.length; i++) { int un = (digest[i] >= 0) ? digest[i] : 256+digest[i]; buffer.append (padLeadingZeroes (Integer.toHexString (un), 2)); } value = buffer.toString (); } return value; }
/** * Returns the value of the SHA-1 digest as a hex string. * Returns null if the digest is not available. */ public String getSHA1 () { String value = null; if (_sha1 != null) { StringBuffer buffer = new StringBuffer (); byte [] digest = _sha1.digest (); for (int i=0; i<digest.length; i++) { int un = (digest[i] >= 0) ? digest[i] : 256+digest[i]; buffer.append (padLeadingZeroes (Integer.toHexString (un), 2)); } value = buffer.toString (); } return value; }