proape
 1 import java.security.MessageDigest;
 2 
 3 public class Demo {
 4 
 5     public static void main(String[] args) throws Exception {
 6         MessageDigest digest = MessageDigest.getInstance("md5");
 7         String pwd = "123456";
 8         byte[] result = digest.digest(pwd.getBytes());
 9         StringBuffer sb = new StringBuffer();
10         for (int i = 0; i < result.length; i++) {
11             String str = Integer.toHexString((0xFF & result[i]));
12             if (str.length() == 1) {
13                 sb.append("0" + str);
14             } else {
15                 sb.append(str);
16             }
17         }
18         System.out.println(sb.toString());
19     }
20 
21 }

分类:

技术点:

相关文章:

  • 2021-11-01
  • 2021-12-24
  • 2021-12-26
  • 2021-11-19
  • 2021-11-01
  • 2022-01-24
  • 2021-07-26
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2021-11-01
  • 2021-12-31
  • 2021-09-21
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案