20081228

Jigloo Key Gen

/**
* The code is E81086713E446D36F62B2AA2A3502B5EB155.
* @author BeanSoft
*/
public class JiglooKeyGen {
public JiglooKeyGen() {
String licStr = testString("Jigloo v3.0.0 Prof", "GH6tfjUtf7");

System.out.println(licStr);
}
private static final String hex[] = {
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"A", "B", "C", "D", "E", "F"
};

private String bytesToHex(byte bytes[])
{
String rep = "";
for(int i = 0; i < bytes.length; i++)
{
int b = bytes[i];
if(b < 0)
b += 256;
rep = rep + hex[b / 16] + hex[b % 16];
if(i % 20 == 19)
rep = rep + "\n";
}

return rep;
}

private String testString(String str, String key)
{
byte en[] = test(str.getBytes(), key.getBytes());
return bytesToHex(en);
}

private byte[] test(byte data[], byte pass[])
{
return test1(test1(data, pass, false), pass, true);
}

private byte[] test1(byte data[], byte pass[], boolean rev)
{
byte en[] = new byte[data.length];
System.arraycopy(data, 0, en, 0, data.length);
if(!rev)
{
for(int i = 0; i < en.length; i++)
{
int j = i % pass.length;
if(i > 0)
en[i] = (byte)(en[i] + en[i - 1] + pass[j]);
else
en[i] = (byte)(en[i] + pass[j]);
}

} else
{
for(int i = en.length - 1; i >= 0; i--)
{
int j = i % pass.length;
if(i != en.length - 1)
en[i] = (byte)(en[i + 1] + en[i] + pass[j]);
else
en[i] = (byte)(en[i] + pass[j]);
}

}
return en;
}

/**
* @param args
*/
public static void main(String[] args) {
new JiglooKeyGen();
}

}