⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stsecurity.java

📁 一套完整的档案管理系统
💻 JAVA
字号:


package com.stsc.util;

import java.security.MessageDigest;

public class STSecurity
{

    public STSecurity()
    {
    }

    public String Encrypt(String s)
    {
        String s1;
        try
        {
            MessageDigest messagedigest = MessageDigest.getInstance("SHA-1");
            messagedigest.update(s.getBytes());
            byte abyte0[] = messagedigest.digest();
            return byte2hex(abyte0);
        }
        catch(Exception exception)
        {
            s1 = "";
        }
        return s1;
    }

    public String byte2hex(byte abyte0[])
    {
        String s = "";
        String s1 = "";
        for(int i = 0; i < abyte0.length; i++)
        {
            String s2 = Integer.toHexString(abyte0[i] & 0xff);
            if(s2.length() == 1)
                s = s + "0" + s2;
            else
                s = s + s2;
            if(i < abyte0.length - 1)
                s = s + ":";
        }

        return s.toUpperCase();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -