Android examples for java.security:MD5
MD5 Encrypt byte array
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] md5Encrypt(byte[] byteArray) { byte[] retBytes = null; try {// w w w .jav a2s . com MessageDigest md = MessageDigest.getInstance("MD5"); md.update(byteArray); retBytes = md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return retBytes; } }