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); }