code: public int substitute(int[] p, int x) {
      int result = 0;
      int y = 1;
      for (int i = 0; i < p.length; i++) {
        result = result ^ mulTable[p[i]][y];
        y = mulTable[x][y];
      }
      return result;
    }
docs: Substitute x into polynomial p(x).
  @param p input polynomial
  @param x input field
  @return p(x)