加密算法

hujunjie123 2012-04-18 04:26:24
public String encryptPWD(String pwd) {
if (pwd == null) {
return pwd = "";
}
if (pwd.length() < 6) {
return "";
}

char[] c = pwd.toCharArray();

for (int i = 0; i < c.length; i++) {
c[i] = (char) ((((int) c[i]) ^ 9) ^ 5 ^ 4 ^ 3);
}

char temp = c[1];
c[1] = c[3];
c[3] = temp;

temp = c[0];
c[0] = c[4];
c[4] = temp;

temp = c[0];
c[0] = c[5];
c[5] = temp;

temp = c[1];
c[1] = c[2];
c[2] = temp;
String result = new String(c);
return result;

}



大侠们看看,上面这段加密代码用的什么加密技术?
或者原理?
...全文
129 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hujunjie123 2012-04-27
  • 打赏
  • 举报
回复
唉, 大侠们都误解我的意思了
Jcainia 2012-04-20
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 的回复:]
看看MD5吧
[/Quote]
做我师父不啊 最近学ssh遇到些瓶颈 我qq852644320
飓风zj 2012-04-18
  • 打赏
  • 举报
回复
看看MD5吧
-AJ- 2012-04-18
  • 打赏
  • 举报
回复
以前还真没做过加密。
学习下。
大力水手POPEYE 2012-04-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

Java code
public String encryptPWD(String pwd) {
if (pwd == null) {
return pwd = "";
}
if (pwd.length() < 6) {
return "";
}

char[] c = pwd.toCharArray();

for (int i = 0; i < c.length; i++) {
c[i] ……
[/Quote]
楼上正解
ncist_jianeng 2012-04-18
  • 打赏
  • 举报
回复
public String encryptPWD(String pwd) {
if (pwd == null) {
return pwd = "";
}
if (pwd.length() < 6) {
return "";
}

char[] c = pwd.toCharArray();

for (int i = 0; i < c.length; i++) {
c[i] = (char) ((((int) c[i]) ^ 9) ^ 5 ^ 4 ^ 3); //int值与9,5,4,3异或
}

//1 ,3对换
char temp = c[1];
c[1] = c[3];
c[3] = temp;

//0,4对换
temp = c[0];
c[0] = c[4];
c[4] = temp;

//0,5对换
temp = c[0];
c[0] = c[5];
c[5] = temp;

//1,2对换
temp = c[1];
c[1] = c[2];
c[2] = temp;
String result = new String(c);
return result;

}

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧