package com.gt.utils;
import java.util.ArrayList;
import java.util.List;
public class Des {
public Des() {
}
public static void main(String[] args) {
Des desObj = new Des();
String key1 = "1";
String key2 = "2";
String key3 = "3";
String data = "admin";
String str = desObj.strEnc(data, key1, key2, key3);
System.out.println(str);
String dec = desObj.strDec(str, key1, key2, key3);
System.out.println(dec);
}
/**
* DES加密/解密
*
* @Copyright Copyright (c) 2006
* @author Guapo
* @see DESCore
*/
/*
* encrypt the string to string made up of hex return the encrypted string
*/
public String strEnc(String data, String firstKey, String secondKey,
String thirdKey) {
int leng = data.length();
String encData = "";
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
int firstLength = 0, secondLength = 0, thirdLength = 0;
if (firstKey != null && firstKey != "") {
firstKeyBt = getKeyBytes(firstKey);
firstLength = firstKeyBt.size();
}
if (secondKey != null && secondKey != "") {
secondKeyBt = getKeyBytes(secondKey);
secondLength = secondKeyBt.size();
}
if (thirdKey != null && thirdKey != "") {
thirdKeyBt = getKeyBytes(thirdKey);
thirdLength = thirdKeyBt.size();
}
if (leng > 0) {
if (leng < 4) {
int[] bt = strToBt(data);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null
&& secondKey != "" && thirdKey != null
&& thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "" && secondKey != null
&& secondKey != "") {
int[] tempBt;
int x, y;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x = 0;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
encByte = tempBt;
}
}
}
encData = bt64ToHex(encByte);
} else {
int iterator = (leng / 4);
int remainder = leng % 4;
int i = 0;
for (i = 0; i < iterator; i++) {
String tempData = data.substring(i * 4 + 0, i * 4 + 4);
int[] tempByte = strToBt(tempData);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null
&& secondKey != "" && thirdKey != null
&& thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != ""
&& secondKey != null && secondKey != "") {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt
.get(x));
}
encByte = tempBt;
}
}
}
encData += bt64ToHex(encByte);
}
if (remainder > 0) {
String remainderData = data.substring(iterator * 4 + 0,
leng);
int[] tempByte = strToBt(remainderData);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null
&& secondKey != "" && thirdKey != null
&& thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != ""
&& secondKey != null && secondKey != "") {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (
没有合适的资源?快使用搜索试试~ 我知道了~
MF00328-企业级Java快速开发框架源码.zip
共593个文件
class:120个
java:120个
gif:79个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 88 浏览量
2023-08-13
20:04:24
上传
评论
收藏 25.25MB ZIP 举报
温馨提示
JAVA快速开发框架源码 企业通用开发平台框架源码 注意:不带技术支持,有帮助文件,虚拟商品,发货不退,看好再拍。 开发语言 : JAVA 数据库 : MySQL 开发工具 : Eclipse 源码类型 : WebForm 系统说明如下: 1、系统源码导入Eclipse、MyEclipse等IDE发布到应用服务器,例如Tomcat上即可运行。 2、导入系统后请将系统编码设置为UTF-8,不是GBK。SQL导入也是UTF8编码。 3、导入后如果出现感叹号,请修改实际的Java Build Path。 4、登录页面:4.1、Hibernate版本访问地址:http://localhost:8080/jeefw/login.jsp 4.2、Mybatis版本访问地址:MySQL版本和Oracle版本都是http://localhost:8080/ + 项目名,账号:admin 密码:1 5、系统默认数据库是mysql。Hibernate版本的applicationContext.xml配置文件里的mysql用户名是root,密码是123456; Mybatis版本在 dbconfig.properties修改。如果和您的不一样,请修改即可运行。 6、基于Bootstrap的Java企业通用开发平台框架只引用了一个第三方jar包(sina.jar),这个第三方jar包的源码在附件压缩包里。 7、系统运行在JDK7+和Tomcat7+。 8、开发环境任何地方不要包含非英文路径。
资源推荐
资源详情
资源评论
收起资源包目录
MF00328-企业级Java快速开发框架源码.zip (593个子文件)
MenuInfServiceImpl.class 22KB
CodeGeneratorByMysqlByLayUIServiceImpl.class 20KB
Des.class 20KB
ByteHandleImpl.class 19KB
InsInfServiceImpl.class 15KB
RoleInfServiceImpl.class 14KB
OperInfServiceImpl.class 14KB
PbUtils.class 11KB
OperInfController.class 11KB
BaseDaoThreadImpl.class 11KB
BaseDaoImpl.class 10KB
SysFunctionInfServiceImpl.class 10KB
DictCdServiceImpl.class 10KB
FileHandle.class 9KB
BaseController.class 9KB
ExportExcelController.class 9KB
MD5.class 8KB
MenuInfController.class 8KB
QuarzServiceImpl.class 7KB
BaseServiceImpl.class 7KB
SysLogServiceImpl.class 6KB
NoInterceptorServiceImpl.class 6KB
RoleInfController.class 6KB
TSysInsInf.class 6KB
DictTpServiceImpl.class 6KB
AuthInterceptor.class 6KB
StudentServiceImpl.class 6KB
TSysOperInf.class 5KB
InsInfController.class 5KB
GetFileName.class 5KB
MapToBeanUtils.class 5KB
DictCdController.class 5KB
RoleFunctionServiceImpl.class 4KB
MapToBeanUtils2.class 4KB
QuarzController.class 4KB
SysFunctionInfController.class 4KB
OperInf.class 4KB
TSysRoleInf.class 4KB
StudentController.class 4KB
TSysMenuInf.class 4KB
SessionInterceptor.class 4KB
RandomValidateCode.class 4KB
MyBeanUtils.class 4KB
DictTpController.class 4KB
FileUploadController.class 4KB
QuarzUtils.class 4KB
NoInterceptorController.class 4KB
InsInf.class 4KB
Timer.class 4KB
UserInfo.class 4KB
FileMD5.class 4KB
TemplateParams.class 3KB
Student.class 3KB
ReadFile.class 3KB
TSysLog.class 3KB
TSysFunctionInf.class 3KB
MenuInf.class 3KB
CodeGeneratorController.class 3KB
TemplateHelp.class 3KB
QuartzInItServlet.class 3KB
ButtonCreateController.class 3KB
Quarz.class 3KB
PropertiesUtils.class 3KB
SysCacheProcessImpl.class 3KB
RoleFunctionController.class 3KB
SysLog.class 3KB
IBaseService.class 2KB
IBaseDao.class 2KB
DictCacheProcessImpl.class 2KB
DataConverter.class 2KB
TSysDictTp.class 2KB
BaseQuartz.class 2KB
RoleOperServiceImpl.class 2KB
TSysDictCd.class 2KB
MenutCacheProcessImpl.class 2KB
MenuForLayUI.class 2KB
TreeForLayUI.class 2KB
TSysRoleOper.class 2KB
TSysRoleFunction.class 2KB
RoleInf.class 2KB
ParseProperties.class 2KB
TSysNointerceptor.class 2KB
CacheInterceptor.class 2KB
DictCd.class 2KB
ImageServlet.class 2KB
IMenuInfService.class 2KB
EncodingInterceptor.class 2KB
CharUtils.class 1KB
Contans.class 1KB
TableFields.class 1KB
DatagridForLayUI.class 1KB
SysFunctionInf.class 1KB
GetIpUtil.class 1KB
SysLogController.class 1KB
ZTree.class 1KB
BasePageForLayUI.class 1KB
Json.class 1KB
Function.class 1KB
IRoleInfService.class 1KB
ISysFunctionInfService.class 1KB
共 593 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
jane9872
- 粉丝: 83
- 资源: 7719
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功