List of utility methods to do MD5 String
String | md5Digest(String word) md Digest try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(word.getBytes()); byte[] byteData = md.digest(); StringBuilder hexString = new StringBuilder(); for (int i = 0; i < byteData.length; i++) { String hex = Integer.toHexString(0xff & byteData[i]); if (hex.length() == 1) ... |
String | md5DigestPassword(String password) Creates a MD5 digest String from a given password. try { MessageDigest md = MessageDigest.getInstance("MD5"); return hexEncode(md.digest(password.getBytes())); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("No MD5 algorithm present on the system"); |
String | md5EncriptionPassword(String str) md Encription Password if (str == null || str.length() == 0) { throw new IllegalArgumentException("String to encript cannot be null or zero length"); digester.update(str.getBytes()); byte[] hash = digester.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < hash.length; i++) { if ((0xff & hash[i]) < 0x10) { ... |
String | md5encrypt(String phrase) mdencrypt return generateHash(phrase, "MD5"); |
String | md5Encrypt(String str) md Encrypt if (str == null) return str; MessageDigest localMessageDigest = null; try { localMessageDigest = MessageDigest.getInstance(MD5_DIGEST); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); localMessageDigest.update(str.getBytes()); byte[] arrayOfByte = localMessageDigest.digest(); return byte2Hex(arrayOfByte); |
String | md5Encrypt(String str) md Encrypt byte[] bytes = null; try { bytes = str.getBytes("UTF-8"); } catch (Exception e) { bytes = str.getBytes(); byte messageDigest[] = null; synchronized (m_md5) { ... |
String | md5Encryption(String str) md Encryption byte[] newStr = null; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); Encoder base = Base64.getEncoder(); newStr = base.encode(md5.digest(str.getBytes("UTF-8"))); } catch (Exception e) { e.printStackTrace(); return newStr.toString(); |
String | md5File(File f) md File MessageDigest md = null; InputStream is = null; try { md = MessageDigest.getInstance("MD5"); is = new FileInputStream(f); is = new DigestInputStream(is, md); byte[] buffer = new byte[4096]; while (is.read(buffer) != -1) { ... |
String | md5file(File file) mdfile byte[] _bytes = null; InputStream is = new FileInputStream(file); MessageDigest digest = MessageDigest.getInstance("MD5"); byte[] buffer = new byte[8192]; int read = 0; while ((read = is.read(buffer)) > 0) { digest.update(buffer, 0, read); _bytes = digest.digest(); if (is != null) { is.close(); is = null; return new BigInteger(1, _bytes).toString(16); |
String | md5FromFile(File file) md From File if (!file.exists()) { return ""; MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); ... |