import java.io.PrintStream;
import java.math.BigInteger;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
import java.util.zip.CRC32;
public class Main {
public static final byte PRODUCT_TYPE = 1; //IntelliJ IDEA
public static final byte PRODUCT_VERSION = 14;
public static final String DEFUALT_NAME
= "IntelliJ IDEA";
public static final char[] encodeTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
public static final int baseDigit = encodeTable.length;
public static final Scanner in
= new Scanner
(System.
in);
public static byte[] writeSignature(char[] name, int salt, byte[] bkey) {
for (char chr : name) {
crc32.update(chr);
}
crc32.update(salt);
crc32.update(salt >> 8);
crc32.update(salt >> 16);
crc32.update(salt >> 24);
for (int i = 0; i < bkey.length - 2; i++) {
crc32.update(bkey[i]);
}
short sign = (short) crc32.getValue();
bkey[10] = (byte) (sign & 255);
bkey[11] = (byte) ((sign >> 8) & 255);
return bkey;
}
StringBuilder builder = new StringBuilder();
for (int i
= 0; key.
compareTo(BigInteger.
ZERO) != 0; i
++) { if (i > 0) {
builder.append("-");
}
int num = key.mod(baseChunk).intValue();
for (int j = 0; j < 5; j++, num /= baseDigit) {
builder.append(encodeTable[num % baseDigit]);
}
key = key.divide(baseChunk);
}
return builder.toString();
}
int salt = rnd.nextInt(100000);
int ld
= (int) (new Date().
getTime() >> 16);
salt %= 100000;
days &= 0xffff;
byte[] bkey = { //size 12
PRODUCT_TYPE,
PRODUCT_VERSION,
(byte) (ld & 0xff),
(byte) ((ld >> 8) & 0xff),
(byte) ((ld >> 16) & 0xff),
(byte) ((ld >> 24) & 0xff),
(byte) (days & 0xff),
(byte) ((days >> 8) & 0xff),
105, -59, 0, 0
};
bkey = writeSignature(name.toCharArray(), salt, bkey);
key = key.modPow(pow, mod);
"%05d-%s",
salt,
keyToString(key)
);
}
public static void main
(String[] args
) { out.printf("\nJetBrains IntelliJ IDEA Keygen\nEnter name [%s]: ", DEFUALT_NAME);
String userName
= in.
nextLine().
trim();
if (userName.isEmpty()) {
userName = DEFUALT_NAME;
}
out.printf("\nName: %s\nKey: %s\n", userName, generateKey(userName, 0));
out.println("Press Enter to exit...");
in.hasNextLine();
}
}
aW1wb3J0IGphdmEuaW8uUHJpbnRTdHJlYW07CmltcG9ydCBqYXZhLm1hdGguQmlnSW50ZWdlcjsKaW1wb3J0IGphdmEudXRpbC5EYXRlOwppbXBvcnQgamF2YS51dGlsLlJhbmRvbTsKaW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwppbXBvcnQgamF2YS51dGlsLnppcC5DUkMzMjsKCnB1YmxpYyBjbGFzcyBNYWluIHsKCiAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGJ5dGUgUFJPRFVDVF9UWVBFID0gMTsgLy9JbnRlbGxpSiBJREVBCiAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGJ5dGUgUFJPRFVDVF9WRVJTSU9OID0gMTQ7CiAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBERUZVQUxUX05BTUUgPSAiSW50ZWxsaUogSURFQSI7CgogICAgcHVibGljIHN0YXRpYyBmaW5hbCBSYW5kb20gcm5kID0gbmV3IFJhbmRvbSgpOwogICAgcHVibGljIHN0YXRpYyBmaW5hbCBjaGFyW10gZW5jb2RlVGFibGUgPSAiMDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaIi50b0NoYXJBcnJheSgpOwoKICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQmlnSW50ZWdlciBwb3cgPSBuZXcgQmlnSW50ZWdlcigiODkxMjYyNzIzMzAxMjgwMDc1NDM1NzgwNTIwMjc4ODgwMDE5ODEiLCAxMCk7CiAgICBwdWJsaWMgc3RhdGljIGZpbmFsIEJpZ0ludGVnZXIgbW9kID0gbmV3IEJpZ0ludGVnZXIoIjg2ZjcxNjg4Y2RkMjYxMmNhMTE3ZDFmNTRiZGFlMDI5IiwgMTYpOwoKICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQmlnSW50ZWdlciBiYXNlQ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3RyaW5nKEJpZ0ludGVnZXIga2V5KSB7CiAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKCiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGtleS5jb21wYXJlVG8oQmlnSW50ZWdlci5aRVJPKSAhPSAwOyBpKyspIHsKICAgICAgICAgICAgaWYgKGkgPiAwKSB7CiAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiLSIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpbnQgbnVtID0ga2V5Lm1vZChiYXNlQ2h1bmspLmludFZhbHVlKCk7CgogICAgICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IDU7IGorKywgbnVtIC89IGJhc2VEaWdpdCkgewogICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoZW5jb2RlVGFibGVbbnVtICUgYmFzZURpZ2l0XSk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGtleSA9IGtleS5kaXZpZGUoYmFzZUNodW5rKTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7CiAgICB9CgoKICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIGdlbmVyYXRlS2V5KFN0cmluZyBuYW1lLCBpbnQgZGF5cykgewogICAgICAgIGludCBzYWx0ID0gcm5kLm5leHRJbnQoMTAwMDAwKTsKICAgICAgICBpbnQgbGQgPSAoaW50KSAobmV3IERhdGUoKS5nZXRUaW1lKCkgPj4gMTYpOwoKICAgICAgICBzYWx0ICU9IDEwMDAwMDsKICAgICAgICBkYXlzICY9IDB4ZmZmZjsKCiAgICAgICAgYnl0ZVtdIGJrZXkgPSB7IC8vc2l6ZSAxMgogICAgICAgICAgICAgICAgUFJPRFVDVF9UWVBFLAogICAgICAgICAgICAgICAgUFJPRFVDVF9WRVJTSU9OLAoKICAgICAgICAgICAgICAgIChieXRlKSAobGQgJiAweGZmKSwKICAgICAgICAgICAgICAgIChieXRlKSAoKGxkID4+IDgpICYgMHhmZiksCiAgICAgICAgICAgICAgICAoYnl0ZSkgKChsZCA+PiAxNikgJiAweGZmKSwKICAgICAgICAgICAgICAgIChieXRlKSAoKGxkID4+IDI0KSAmIDB4ZmYpLAoKICAgICAgICAgICAgICAgIChieXRlKSAoZGF5cyAmIDB4ZmYpLAogICAgICAgICAgICAgICAgKGJ5dGUpICgoZGF5cyA+PiA4KSAmIDB4ZmYpLAoKICAgICAgICAgICAgICAgIDEwNSwgLTU5LCAwLCAwCiAgICAgICAgfTsKCiAgICAgICAgYmtleSA9IHdyaXRlU2lnbmF0dXJlKG5hbWUudG9DaGFyQXJyYXkoKSwgc2FsdCwgYmtleSk7CgogICAgICAgIEJpZ0ludGVnZXIga2V5ID0gbmV3IEJpZ0ludGVnZXIoYmtleSk7CiAgICAgICAga2V5ID0ga2V5Lm1vZFBvdyhwb3csIG1vZCk7CgogICAgICAgIHJldHVybiBTdHJpbmcuZm9ybWF0KAogICAgICAgICAgICAgICAgIiUwNWQtJXMiLAogICAgICAgICAgICAgICAgc2FsdCwKICAgICAgICAgICAgICAgIGtleVRvU3RyaW5nKGtleSkKICAgICAgICApOwogICAgfQoKCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgb3V0LnByaW50ZigiXG5KZXRCcmFpbnMgSW50ZWxsaUogSURFQSBLZXlnZW5cbkVudGVyIG5hbWUgWyVzXTogIiwgREVGVUFMVF9OQU1FKTsKICAgICAgICBTdHJpbmcgdXNlck5hbWUgPSBpbi5uZXh0TGluZSgpLnRyaW0oKTsKCiAgICAgICAgaWYgKHVzZXJOYW1lLmlzRW1wdHkoKSkgewogICAgICAgICAgICB1c2VyTmFtZSA9IERFRlVBTFRfTkFNRTsKICAgICAgICB9CgogICAgICAgIG91dC5wcmludGYoIlxuTmFtZTogJXNcbktleTogICVzXG4iLCB1c2VyTmFtZSwgZ2VuZXJhdGVLZXkodXNlck5hbWUsIDApKTsKCiAgICAgICAgb3V0LnByaW50bG4oIlByZXNzIEVudGVyIHRvIGV4aXQuLi4iKTsKICAgICAgICBpbi5oYXNOZXh0TGluZSgpOwogICAgfQoKfQ==