精华内容
下载资源
问答
  • MD5加密工具类

    2018-08-07 18:12:37
    MD5加密工具类,MD5加密工具类,MD5加密工具类,MD5加密工具类,MD5加密工具类,MD5加密工具类,MD5加密工具类,MD5加密工具类
  • md5加密工具类

    2017-01-19 21:30:05
    md5加密工具类
  • Md5加密工具类

    2018-07-20 16:36:00
    Md5加密工具类: 1 package com.microClass.util; 2 3 /** 4 * Created by asus on 2017/4/26. 5 */ 6 import java.io.UnsupportedEncodingException; 7 import java.security.MessageDigest; 8 ...

    Md5加密工具类:

     1 package com.microClass.util;
     2 
     3 /**
     4  * Created by asus on 2017/4/26.
     5  */
     6 import java.io.UnsupportedEncodingException;
     7 import java.security.MessageDigest;
     8 import java.security.NoSuchAlgorithmException;
     9 
    10 import org.apache.commons.codec.binary.Hex;
    11 
    12 public class MD5Util{
    13 
    14     public static String encode(String origin, String charsetname){
    15         String resultString = null;
    16         resultString = new String(origin);
    17         MessageDigest md;
    18         try{
    19             md = MessageDigest.getInstance("MD5");
    20         }catch(NoSuchAlgorithmException e){
    21             throw new RuntimeException(e);
    22         }
    23         if(charsetname == null || "".equals(charsetname)){
    24             resultString = Hex.encodeHexString(md.digest(resultString.getBytes()));
    25         }else{
    26             try{
    27                 resultString = Hex.encodeHexString(md.digest(resultString.getBytes(charsetname)));
    28             }catch(UnsupportedEncodingException e){
    29                 throw new RuntimeException(e);
    30             }
    31         }
    32         return resultString;
    33     }
    34 
    35     public static String encode(String origi){
    36        // String st=origi+"45678";
    37         return encode(origi,"utf-8");
    38     }
    39     public static String encodeStrong(String origi){
    40         if (origi!=null){
    41             int length = origi.length();
    42             String str=origi+String.valueOf(length)+origi;
    43             //123456 6 123456
    44             return encode(str,"utf-8");
    45         }
    46         return encode("12345678","utf-8");
    47     }
    48     public static void main(String[] args) {
    49         System.out.println("md5="+MD5Util.encode("5"));
    50     }
    51 }

     

     

    MD5 升级优化 加盐(Java)

    https://blog.csdn.net/dingsai88/article/details/51637977

     

    转载于:https://www.cnblogs.com/dw3306/p/9342275.html

    展开全文

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,923
精华内容 769
关键字:

md5加密工具类