コード例 #1
0
  // This finds the final sums of iR[i]
  private int findSumiRi() {
    int[] sum = new int[29];
    int length = 28;

    // Find iRi
    int[] iR = new int[29];

    for (int i = 0; i < 29; i++) iR[i] = M.myMod((i * R[i]), 29);

    // System.out.print("iRi: ");
    // for(int i = 0; i < 29; i++)
    // System.out.print(iR[i] + " ");
    // System.out.println();

    for (int i = 0; i < 29; i++) sum[i] = iR[i];

    for (int j = 0; j < 28; j++) {
      for (int i = 0; i < length; i++) {
        sum[i] = sum[i + 1] - sum[i];
        sum[i] = M.myMod(sum[i], 29);
        // System.out.print(sum[i] + " ");
      }
      length = length - 1;
      // System.out.println();
    }
    return sum[0];
  }
コード例 #2
0
  // This finds the final sums of EiRi[] and stores it in RiEiLeading[]
  private void findSums(int[] myArray) // This is for RiEi
      {
    int[] sum = myArray;
    int length = 28;

    /*
     * System.out.print("Ri: "); // Delete Later for(int i = 0; i < 29; i++)
     * System.out.print(R[i] + ", "); System.out.println();
     *
     * System.out.print("Ei: "); // Delete Later for(int i = 0; i < 29; i++)
     * System.out.print(Ei[i] + ", "); System.out.println("\n");
     *
     * System.out.print("RiEi: "); for(int i = 0; i < 29; i++)
     * System.out.print(myArray[i] + ", "); System.out.println();
     */

    RiEiLeading[0] = myArray[0];

    for (int j = 0; j < 28; j++) {
      for (int i = 0; i < length; i++) {
        sum[i] = sum[i + 1] - sum[i];
        sum[i] = M.myMod(sum[i], 29);
        // System.out.print(sum[i] + " ");
      }
      RiEiLeading[j + 1] = sum[0];
      length--;
    }
  }
コード例 #3
0
  // This finds the final sums of R[i]
  private int findSumRi() {
    int[] sum = new int[29];
    int length = 28;

    for (int i = 0; i < 29; i++) sum[i] = R[i];

    // System.out.print("Ri: ");
    // for(int i = 0; i < 29; i++)
    // System.out.print(R[i] + " "); // WAS System.out.print(R[i + start] +
    // " ");

    System.out.println();

    for (int j = 0; j < 28; j++) {
      for (int i = 0; i < length; i++) {
        sum[i] = sum[i + 1] - sum[i];
        sum[i] = M.myMod(sum[i], 29);
        // System.out.print(sum[i] + " ");
      }
      length = length - 1;
      // System.out.println();
    }
    return sum[0];
  }