This commit is contained in:
Jesse-Ma
2022-12-09 14:16:15 +08:00
parent 17ff6e710c
commit 5cb7ee80b8
8 changed files with 127 additions and 9 deletions

View File

@@ -84,12 +84,51 @@ public class BizKeyUtils {
return Integer.parseInt(String.valueOf(new Date().getTime()).substring(0, 4));
}
public static String getCipher(String key) {
return md5(key + MIX_STRING + key);
public static String getCipher(String key,String initTime) {
return md5(key +"#"+ MIX_STRING + "#" + initTime);
}
public static Boolean validateCipher(String key,String initTime,String cipher) {
return md5(key +"#"+ MIX_STRING + "#" + initTime).equals(cipher);
}
public static String getSecretKey(String key, String password) {
return md5(key + md5(MIX_STRING + password));
}
public static void main(String[] args) {
int c = 0;
while(true) {
c++;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 16; i++) {
sb.append(RANGE_STRING.charAt(RandomUtils.nextInt(30)));
}
Boolean result = validateKey(sb.toString());
if(c%1000==0) {
System.out.println(c);
System.out.println(result);
System.out.println(sb.toString());
}
if(result) {
System.out.println(c);
System.out.println(result);
System.out.println(sb.toString());
break;
}
}
}
}