MD5编码字符串的代码
来源:互联网 发布:shadownsocks ubuntu 编辑:程序博客网 时间:2024/05/21 00:15
public class MD5Secret { public static String toMD5(String data) { try { // 实例化一个指定摘要算法为MD5的MessageDigest对象 MessageDigest algorithm = MessageDigest.getInstance("MD5"); // 重置摘要以供再次使用 algorithm.reset(); // 使用bytes更新摘要 algorithm.update(data.getBytes()); // 使用指定的byte数组对摘要进行最的更新,然后完成摘要计算 return toHexString(algorithm.digest()); } catch (NoSuchAlgorithmException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); return ""; } } // 将字符串中的每个字符转换为十六进制 private static String toHexString(byte[] bytes) { StringBuilder hexstring = new StringBuilder(); for (byte b : bytes) { String hex = Integer.toHexString(0xFF & b); if (hex.length() == 1) { hexstring.append('0'); } hexstring.append(hex); } return hexstring.toString(); }}
0 0
- MD5编码字符串的代码
- android项目代码整理之得到字符串的MD5编码类GetMD5
- MD5与字符串编码
- BREW 实现字符串MD5编码
- perl字符串MD5编码解决
- [小代码]md5加密字符串
- MD5加密之后之后转换为十六进制字符串的代码
- 【代码】.NET中获取字符串的MD5码
- python 字符串(汉语)获得MD5编码
- 字符串的MD5加密
- ASP的MD5编码函数
- md5编码的两个程序
- MD5编码相关的类
- md5的java代码
- wp 的MD5代码
- MD5代码MD5工具类的写法
- VS2008可否配置代码中字符串的编码是ANSI编码不用Unicode编码?
- MD5编码
- 复位应答ATR的基本结构和数据单元
- linux下使用tar命令
- C++重载运算符相关
- centos6.7 32位系统安装后无法连接wifi,原因是没有安装相应的无线网卡驱动
- 快速Android开发系列网络篇之Retrofit, Retrofit OKHttp GSON
- MD5编码字符串的代码
- Delete Digits
- J2SE视频之初识Java
- 掌握HTML 的表格,表单,列表标签
- ClassPathXmlApplicationContext
- poj1651 Multiplication Puzzle
- WireShark查看指定的PC应用的网络包
- DES加密字符串算法(32位)
- JSONArray和JSONObject对象之间的操作