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;
}
大侠们看看,上面这段加密代码用的什么加密技术?
或者原理?
------解决方案--------------------
- 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] = (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;}
------解决方案--------------------
------解决方案--------------------
以前还真没做过加密。
学习下。
------解决方案--------------------
看看MD5吧