package com.lh.model;
/**
 * 安全加密类(MD5)!
 * 
 * @author LH
 */
import java.security.*;
import java.security.spec.*;
public class Md5 {
	public final static String getMD5(String str){
		try {
			MessageDigest md = MessageDigest.getInstance("SHA");//创建具有指定算法名称的摘要
			md.update(str.getBytes());                    //使用指定的字节数组更新摘要
			byte mdBytes[] = md.digest();                 //进行哈希计算并返回一个字节数组
			
			String hash = "";
			for(int i= 0;i<mdBytes.length;i++){           //循环字节数组
				int temp;
				if(mdBytes[i]<0)                          //如果有小于0的字节,则转换为正数
					temp =256+mdBytes[i];
				else
					temp=mdBytes[i];
				if(temp<16)
					hash+= "0";
				hash+=Integer.toString(temp,16);         //将字节转换为16进制后,转换为字符串
			}
			return hash;
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
最近下载更多
                
                过过成功尺寸     LV7
                2021年12月22日
            
            
        
                kiritoYCQ     LV5
                2020年11月28日
            
            
        
                dyihui     LV12
                2020年11月19日
            
            
        
                霖望1234     LV2
                2020年7月18日
            
            
        
                本机号码     LV2
                2020年7月6日
            
            
        
                秘制酒心巧克力     LV6
                2020年6月19日
            
            
        
                wangshangkun     LV2
                2020年5月25日
            
            
        
                木扬木     LV2
                2020年4月25日
            
            
        
                大杰打劫     LV8
                2020年3月24日
            
            
        
                gezongyuan     LV9
                2020年1月7日
            
            
        
最近浏览更多
                
                PISCESPLUS     LV5
                2024年9月3日
            
            
        
                ymrdhgv    
                2024年6月24日
            
            
                    暂无贡献等级
            
        
                晴曛     LV6
                2024年2月20日
            
            
        
                xiquyiyuan     LV10
                2024年1月12日
            
            
        
                WBelong     LV8
                2023年12月28日
            
            
        
                Henew168     LV2
                2023年12月4日
            
            
        
                李朝磊     LV18
                2023年10月23日
            
            
        
                陆程江     LV2
                2023年5月28日
            
            
        
                uni-code_0123     LV1
                2023年4月20日
            
            
        
                ssmss951     LV3
                2023年2月27日
            
            
        
                
                
                