public String MD5(String md5) { try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException e) { Logger lgr = Logger.getLogger(UserService.class); lgr.log(Level.WARNING, e.getMessage(), e); } return null; }
I'm a software engineer, interested learning the best technologies, and contribute to the industry.
Saturday, January 16, 2016
MD5 encryption
Labels:
Java Utils
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment