|
@@ -1,7 +1,5 @@
|
|
|
package com.fdkankan.common.util;
|
|
|
|
|
|
-import net.lingala.zip4j.exception.ZipException;
|
|
|
-
|
|
|
import javax.crypto.Cipher;
|
|
|
import javax.crypto.SecretKey;
|
|
|
import javax.crypto.SecretKeyFactory;
|
|
@@ -169,42 +167,6 @@ public class PasswordUtils {
|
|
|
return (byte) "0123456789ABCDEF".indexOf(c);
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) throws ZipException {
|
|
|
-
|
|
|
- //管理后台密码加解密
|
|
|
-// String userName = "admin6";
|
|
|
-// String password = "123456";
|
|
|
-//
|
|
|
-// try {
|
|
|
-// byte[] salt = PasswordUtils.getStaticSalt();
|
|
|
-// String ciphertext = PasswordUtils.encrypt(userName, password, salt);
|
|
|
-// System.out.println(ciphertext);
|
|
|
-// String plaintext = PasswordUtils.decrypt(ciphertext, password, salt);
|
|
|
-// System.out.println(plaintext);
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-
|
|
|
-// String filePath = "C:\\Users\\dsx\\Desktop\\90d95cdb5_202211141023024060\\90d95cdb5_202211141023024060.zip";
|
|
|
-// String zipFileName = filePath.substring(filePath.lastIndexOf("\\") + 1);
|
|
|
-// System.out.println(zipFileName);
|
|
|
-// String finalFilePath = FileUtil.getParent(filePath, 1);
|
|
|
-// System.out.println(finalFilePath);
|
|
|
-//
|
|
|
-// String zipName = FileUtil.mainName(zipFileName);
|
|
|
-// System.out.println(zipName);
|
|
|
-
|
|
|
-// ZipFile zipFile = new ZipFile(new File(filePath));
|
|
|
-// if (zipFile.isEncrypted()) {
|
|
|
-// String pwd = zipFileName.substring(0, 5).concat(zipFileName.substring(0, 5));
|
|
|
-// zipFile.setPassword(pwd);
|
|
|
-// zipFile.extractAll(finalFilePath);
|
|
|
-// } else {
|
|
|
-// ZipUtil.unzip(filePath, finalFilePath);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 模拟前端密码加密
|
|
@@ -232,6 +194,4 @@ public class PasswordUtils {
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|