【Java】SHA加密

package sdfg;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class sdfg {
    
    public static String createMD5(String pw) throws NoSuchAlgorithmException
    {
        MessageDigest md;
        md=MessageDigest.getInstance("SHA");
        md.update(pw.getBytes());
        String re=new BigInteger(1,md.digest()).toString(16);                
        return re;        
    }
    
    public static void main(String[] args) throws NoSuchAlgorithmException 
    {
        String pw="dfgdf";
        
        System.out.println(createMD5(pw));
    }
}

 

转载于:https://www.cnblogs.com/tiandsp/p/7467833.html

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页