public class Encryption {
private static final int[] encrypt = {2, 9, 3, 4, 6, 8, 1, 0};
private static final int[] decrypt = new int[8];
private static final int minLength = 10;
String encrypt (String password) {
if(password.length()<minLength) {
return password;
} else {
char[] encrypt = password.toCharArray();
for (int i = 0; i < encrypt.length; i++) {
encrypt[i] = (char) (encrypt[i]);
}
return String.valueOf(encrypt);
}
}
String decrypt (String password) {
if (password.length()<minLength) {
return password;
} else {
char[] decrypt = password.toCharArray();
for (int i = 0; i < decrypt.length; i++) {
decrypt[i] = (char) (decrypt[i]);
}
return String.valueOf(decrypt);
}
}
boolean isValidLength (String password) {
if (password.length()<minLength) {
return true;
} else {
return false;
}
}
int getMinLength(){
return minLength;
}
}
假设要加密我的密码(尚未制作驱动程序),但不确定我是否正确使用了我的变量(加密和解密)。Encrypt 和 Decrypt 变量使密码将索引更改为用户输入的任何内容,并且也不知道,但我假设在某处使用逆转换方法,但不确定在哪里?有什么帮助吗?需要有人告诉我我的程序是否已经结束或接近。