/** * Calculate the MD5 digest of the given bytes. * * @param bytes * the bytes to calculate the digest over * @return the digest */ public static byte[] md5Digest(byte[] bytes) { return digest(MD5_ALGORITHM_NAME, bytes); }
/** * Calculate the MD5 digest of the given bytes. * * @param bytes * the bytes to calculate the digest over * @return the digest */ public static byte[] md5Digest(byte[] bytes) { return digest(MD5_ALGORITHM_NAME, bytes); }
/** * Calculate the MD5 digest of the given bytes. * * @param bytes * the bytes to calculate the digest over * @return the digest */ public static byte[] sha1Digest(byte[] bytes) { return digest(SHA1_ALGORITHM_NAME, bytes); }
/** * Calculate the MD5 digest of the given bytes. * * @param bytes * the bytes to calculate the digest over * @return the digest */ public static byte[] sha1Digest(byte[] bytes) { return digest(SHA1_ALGORITHM_NAME, bytes); }
public static String md5Digest(String string) { Validate.notBlank(string, "The string to get the hash from cannot be blank"); char[] encodedDigest; try { byte[] digest = digest(MD5_ALGORITHM_NAME, string.getBytes("UTF-8")); encodedDigest = encodeHex(digest); } catch (UnsupportedEncodingException e) { throw new DandelionException("Unable to get a MD5 hash of " + string, e); } return new String(encodedDigest); }
public static String md5Digest(String string) { Validate.notBlank(string, "The string to get the hash from cannot be blank"); char[] encodedDigest; try { byte[] digest = digest(MD5_ALGORITHM_NAME, string.getBytes("UTF-8")); encodedDigest = encodeHex(digest); } catch (UnsupportedEncodingException e) { throw new DandelionException("Unable to get a MD5 hash of " + string, e); } return new String(encodedDigest); }