コード例 #1
0
  private static void tryKeyAt(char ch, int row, int col) {
    String cipherText = cipherTexts.get(row);
    printChangesInCell(-1, col);
    key[col] = CryptoHelpers.xorCharAt(cipherText, ch, col);
    printChangesInCell(-1, col);
    for (int i = 0; i < possibleLetters.length; i++) {

      printChangesInCell(i, col);
      resultLetters[i][col] = CryptoHelpers.xorCharAt(cipherTexts.get(i), key[col], col);
      printChangesInCell(i, col);
    }
  }
コード例 #2
0
  private static void calculateXorsGrid() {
    if (DEBUG) System.out.println(cipherTexts.get(cipherTexts.size() - 1));
    for (int i = 0; i < possibleLetters.length; i++) {
      String currText = cipherTexts.get(i);
      String currTextXorResult =
          CryptoHelpers.xorHex(currText, cipherTexts.get(cipherTexts.size() - 1));
      String xorText = CryptoHelpers.fromHex(currTextXorResult);

      if (DEBUG) System.out.println(currText + "\n" + xorText);

      for (int j = 0; j < possibleLetters[0].length && j < xorText.length(); j++)
        possibleLetters[i][j] = xorText.charAt(j);
    }
  }