Here you can find the source of md5(String inStr)
Parameter | Description |
---|---|
inStr | a parameter |
public static byte[] md5(String inStr)
//package com.java2s; import java.security.MessageDigest; public class Main { /**/*from www. j a v a2 s .c om*/ * generate 32-bit md5 * @param inStr * @return * @author <a href="mailto:iffiff1@gmail.com">Tyler Chen</a> * @since 2015-2-6 */ public static byte[] md5(String inStr) { MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { System.out.println(e.toString()); e.printStackTrace(); return new byte[0]; } char[] charArray = inStr.toCharArray(); byte[] byteArray = new byte[charArray.length]; for (int i = 0; i < charArray.length; i++) { byteArray[i] = (byte) charArray[i]; } return md5.digest(byteArray); } }