- 博客(0)
- 资源 (2)
- 收藏
- 关注
MD5SIGN.java
Android开发过程中加密用的,比如
public static String getMD5Sign(String ciphertext){
LOGGER.info("需要签名的参数:{}",ciphertext);
if ("".equals(ciphertext) || null == ciphertext || "".equals(ciphertext.trim())) {
return null;
}
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
try {
byte[] btInput = ciphertext.getBytes("utf-8");
MessageDigest mdInst = MessageDigest.getInstance("MD5");
mdInst.update(btInput);
byte[] md = mdInst.digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
return null;
}
2019-06-15
Android 源代码
这里面有短信语音播报源码、多媒体播放器源码、任务管理器源码、贪吃蛇游戏源码、天气预报源码、通讯录源码、图片浏览器源码、文件浏览器源码、音乐播放器源码等,欢迎下载参考。
2013-02-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人