public class Main {
private static String mainKey;
private static String mainCipher;
public static void main(String[] args) {
mainKey = convertToBinary("YAMEO");
mainCipher = convertToBinary("5f67fc6c0b8e73c39188cea354bb31eb85008ae1b6c51c16a4dfd8c0509fb960a8241f6d9a8e700450d5553acabe01d3e03b4cbf3050a54en" +
"5f67fc6c0b8e73c39188cea354bb31eb85008ae1b6c51c16a4dfd8c0509fb960a8241f6d9a8e700450d5553acabe01d3e03b4cbf3050a54en" +
"5f67fc6c0b8e73c39188cea354bb31eb85008ae1b6c51c16743eb9f5ef229159n");
String keyA = convertToBinary("YAMEK");
String cipherA = convertToBinary("8f04ebe8c8c030d2413be892640ebd097455b99cd3f11ea898b0adff9ef20985a2a6a44b81c4e558637170482ee4236fc3e7504f2aeb88e3n" +
"8f04ebe8c8c030d2413be892640ebd097455b99cd3f11ea898b0adff9ef20985a2a6a44b81c4e558637170482ee4236fc3e7504f2aeb88e3n" +
"8f04ebe8c8c030d2413be892640ebd097455b99cd3f11ea8a0e38e1ded248b33n");
String keyB = convertToBinary("YAMEP");
String cipherB = convertToBinary("0bcb11158ccf687f92403f7d35365adfc8fada72657c95f7310366c67b8af50b5f839c1f02e11b08dabedaf3ccfd8ae07125640ab29265ban" +
"0bcb11158ccf687f92403f7d35365adfc8fada72657c95f7310366c67b8af50b5f839c1f02e11b08dabedaf3ccfd8ae07125640ab29265ban" +
"0bcb11158ccf687f92403f7d35365adfc8fada72657c95f78572d9759e58a655n");
String keyC = convertToBinary("YAMON");
String cipherC = convertToBinary("7b4c8b41d78a32f0aba8c10ac0411e3bf97cb2a284bedcd0d9350bc9cb67fc9438bc6fc383ebf50f35f28c2ecd2e280b677b78fb0806146fn" +
"7b4c8b41d78a32f0aba8c10ac0411e3bf97cb2a284bedcd0d9350bc9cb67fc9438bc6fc383ebf50f35f28c2ecd2e280b677b78fb0806146fn" +
"7b4c8b41d78a32f0aba8c10ac0411e3bf97cb2a284bedcd0908631f438a5a597n");
check(keyA, cipherA);
check(keyB, cipherB);
check(keyC, cipherC);
}
private static String convertToBinary(String text) {
StringBuilder builder = new StringBuilder();
char[] textChars = text.toCharArray();
for (char c : textChars) {
builder.append(Integer.toBinaryString(c));
}
return builder.toString();
}
private static void check(String key, String cipher) {
int keyDifferent = 0;
int cipherDifferent = 0;
for(int i=0;i<mainKey.length();i++){
if(mainKey.charAt(i)!=key.charAt(i)){
keyDifferent++;
}
}
for(int i=0;i<mainCipher.length();i++){
if(i>=cipher.length()) break;
if(mainCipher.charAt(i)!=cipher.charAt(i)){
cipherDifferent++;
}
}
System.out.println("KEY: " + keyDifferent);
System.out.println("CIPHER: " + cipherDifferent);
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}