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

📄 digpwd.java

📁 自己实现的AES和DES的加密算法。自己可以随意组成加密数据结构
💻 JAVA
字号:
package com.cmcc.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.cmcc.common.util.ByteOprs;
import com.cmcc.common.util.SHA1;
import com.cmcc.common.util.StringUtil;
import com.cmcc.web.servlet.FetionSsoCmwapServlet;
import com.cmcc.ws.info.UserInfo;

public class DigPwd {
	private static Log log = LogFactory.getLog(FetionSsoCmwapServlet.class);
	public static String getDigPwd(String digest, UserInfo users) throws Exception
	{
		String digpwd = "", pwd = "";
		SHA1 sha1 = new SHA1();
		byte[] hexb = ByteOprs.hex2byte(digest);
		byte[] bint = new byte[4];
		for (int i = 0; i < 4; i++) {
			bint[i] = hexb[i];
		}
		String epwd = users.getEpwd();
		pwd = StringUtil.getPwd(epwd);
		byte[] b2 = pwd.getBytes("utf-8");
		byte[] bsha = sha1.getDigestOfBytes(b2);
		byte[] b3 = new byte[bint.length + bsha.length];
		for (int i = 0; i < bint.length; i++) {
			b3[i] = bint[i];
		}
		for (int i = bint.length; i < b3.length; i++) {
			b3[i] = bsha[i - bint.length];
		}

		byte[] bsha1 = sha1.getDigestOfBytes(b3);
		byte[] b4 = new byte[bint.length + bsha1.length];
		for (int i = 0; i < bint.length; i++) {
			b4[i] = bint[i];
		}
		for (int i = bint.length; i < b4.length; i++) {
			b4[i] = bsha1[i - bint.length];
		}
		digpwd = SHA1.byteArrayToHexString(b4);
		log.info("digpwd : " + digpwd);
		return digpwd;
	}
}

⌨️ 快捷键说明

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