public Permutation getP() { return new Permutation(encP); }
public Permutation getP1() { return new Permutation(encP1); }
public Permutation getP2() { return new Permutation(encP2); }
public Permutation getP() { return new Permutation(encP); }
public Permutation getP1() { return new Permutation(encP1); }
public Permutation getP2() { return new Permutation(encP2); }
/** * Compute the inverse permutation <tt>P<sup>-1</sup></tt>. * * @return <tt>this<sup>-1</sup></tt> */ public Permutation computeInverse() { Permutation result = new Permutation(perm.length); for (int i = perm.length - 1; i >= 0; i--) { result.perm[perm[i]] = i; } return result; }
/** * Compute the inverse permutation <tt>P<sup>-1</sup></tt>. * * @return <tt>this<sup>-1</sup></tt> */ public Permutation computeInverse() { Permutation result = new Permutation(perm.length); for (int i = perm.length - 1; i >= 0; i--) { result.perm[perm[i]] = i; } return result; }
/** * Compute the product of this permutation and another permutation. * * @param p the other permutation * @return <tt>this * p</tt> */ public Permutation rightMultiply(Permutation p) { if (p.perm.length != perm.length) { throw new IllegalArgumentException("length mismatch"); } Permutation result = new Permutation(perm.length); for (int i = perm.length - 1; i >= 0; i--) { result.perm[i] = perm[p.perm[i]]; } return result; }
/** * Compute the product of this permutation and another permutation. * * @param p the other permutation * @return <tt>this * p</tt> */ public Permutation rightMultiply(Permutation p) { if (p.perm.length != perm.length) { throw new IllegalArgumentException("length mismatch"); } Permutation result = new Permutation(perm.length); for (int i = perm.length - 1; i >= 0; i--) { result.perm[i] = perm[p.perm[i]]; } return result; }
goppaPoly = new PolynomialGF2mSmallM(field, encGoppaPoly); sInv = new GF2Matrix(encSInv); p1 = new Permutation(encP1); p2 = new Permutation(encP2); h = new GF2Matrix(encH); qInv = new PolynomialGF2mSmallM[encQInv.length];
/** * Create an nxn random regular matrix. * * @param n number of rows (and columns) * @param sr source of randomness */ private void assignRandomRegularMatrix(int n, SecureRandom sr) { numRows = n; numColumns = n; length = (n + 31) >>> 5; matrix = new int[numRows][length]; GF2Matrix lm = new GF2Matrix(n, Matrix.MATRIX_TYPE_RANDOM_LT, sr); GF2Matrix um = new GF2Matrix(n, Matrix.MATRIX_TYPE_RANDOM_UT, sr); GF2Matrix rm = (GF2Matrix)lm.rightMultiply(um); Permutation perm = new Permutation(n, sr); int[] p = perm.getVector(); for (int i = 0; i < n; i++) { System.arraycopy(rm.matrix[i], 0, matrix[p[i]], 0, length); } }
/** * Create an nxn random regular matrix. * * @param n number of rows (and columns) * @param sr source of randomness */ private void assignRandomRegularMatrix(int n, SecureRandom sr) { numRows = n; numColumns = n; length = (n + 31) >>> 5; matrix = new int[numRows][length]; GF2Matrix lm = new GF2Matrix(n, Matrix.MATRIX_TYPE_RANDOM_LT, sr); GF2Matrix um = new GF2Matrix(n, Matrix.MATRIX_TYPE_RANDOM_UT, sr); GF2Matrix rm = (GF2Matrix)lm.rightMultiply(um); Permutation perm = new Permutation(n, sr); int[] p = perm.getVector(); for (int i = 0; i < n; i++) { System.arraycopy(rm.matrix[i], 0, matrix[p[i]], 0, length); } }
goppaPoly = new PolynomialGF2mSmallM(field, encGoppaPoly); sInv = new GF2Matrix(encSInv); p1 = new Permutation(encP1); p2 = new Permutation(encP2); h = new GF2Matrix(encH); qInv = new PolynomialGF2mSmallM[encQInv.length];
/** * Create an nxn random regular matrix. * * @param n number of rows (and columns) * @param sr source of randomness */ public void assignRandomRegularMatrix(int n, SecureRandom sr) { numRows = n; numColumns = n; length = (n + (INTSIZE-1)) >>> BLOCKEXP; matrix = new int[numRows][length]; GF2MatrixEx lm = new GF2MatrixEx(n, Matrix.MATRIX_TYPE_RANDOM_LT, sr); GF2MatrixEx um = new GF2MatrixEx(n, Matrix.MATRIX_TYPE_RANDOM_UT, sr); GF2MatrixEx rm = (GF2MatrixEx)lm.rightMultiply(um); Permutation perm = new Permutation(n, sr); int[] p = perm.getVector(); for (int i = 0; i < n; i++) { System.arraycopy(rm.getIntArray()[i], 0, matrix[p[i]], 0, length); } }
field = new GF2mField(encFieldPoly); goppaPoly = new PolynomialGF2mSmallM(field, encGoppaPoly); p = new Permutation(encP); h = new GF2Matrix(encH); qInv = new PolynomialGF2mSmallM[encQInv.length];
p = new Permutation(n, sr); hp = (GF2Matrix)h.rightMultiply(p); sInv = hp.getLeftSubMatrix();
p = new Permutation(n, sr); hp = (GF2Matrix)h.rightMultiply(p); sInv = hp.getLeftSubMatrix();
Permutation p2 = new Permutation(n, random);
Permutation p2 = new Permutation(n, random);