下载jar包:https://pan.baidu.com/s/1TxnW8DqEgRvIL4Urqlnzyw
在线回复密码:QQ1085220040
把jar包添加到libs下并且add as Lib
/*** 利用MD5进行加密** @param str* 待加密的字符串* @return 加密后的字符串* @throws NoSuchAlgorithmException* 没有这种产生消息摘要的算法* @throws UnsupportedEncodingException*/public String EncoderByMd5(String str) throws NoSuchAlgorithmException,UnsupportedEncodingException {// 确定计算方法MessageDigest md5 = MessageDigest.getInstance("MD5");BASE64Encoder base64en = new BASE64Encoder();// 加密后的字符串String newstr = base64en.encode(md5.digest(str.getBytes("utf-8")));return newstr;
}
或者自定义BASE64Encoder
https://blog.csdn.net/meixi_android/article/details/80893252