/** * Calculates the MD5 digest and returns the value as a byte array. */ public static byte[] digestToBytes(byte[] data) { return Digests.md5(data); }
/** * Calculates the MD5 digest and returns the value as a base64 string. * * @param data Data to digest * @return MD5 digest as a base64 string */ public static String md5Base64(String data) { return Base64.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a base64 string. * * @param data Data to digest * @return MD5 digest as a base64 string * @throws IOException On error reading from the stream * @since 1.4 */ public static String md5Base64(InputStream data) throws IOException { return Base64.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String md5Hex(InputStream data) throws IOException { return Hex.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a 16 element <code>byte[]</code>. * * @param data Data to digest * @return MD5 digest */ public static byte[] md5(String data) { return md5(getBytesUtf8(data)); }
/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string */ public static String md5Hex(String data) { return Hex.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a base64 string. * * @param data Data to digest * @return MD5 digest as a base64 string */ public static String md5Base64(byte[] data) { return Base64.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string */ public static String md5Hex(byte[] data) { return Hex.encode(md5(data)); }