67,513
社区成员
发帖
与我相关
我的任务
分享
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;
}