/** * @return a byte array encoding of this vector */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] res = new byte[vector.length * count]; count = 0; for (int i = 0; i < vector.length; i++) { for (int j = 0; j < d; j += 8) { res[count++] = (byte)(vector[i] >>> j); } } return res; }
/** * @return a byte array encoding of this vector */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] res = new byte[vector.length * count]; count = 0; for (int i = 0; i < vector.length; i++) { for (int j = 0; j < d; j += 8) { res[count++] = (byte)(vector[i] >>> j); } } return res; }
/** * Returns encoded polynomial, i.e., this polynomial in byte array form * * @return the encoded polynomial */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] res = new byte[coefficients.length * count]; count = 0; for (int i = 0; i < coefficients.length; i++) { for (int j = 0; j < d; j += 8) { res[count++] = (byte)(coefficients[i] >>> j); } } return res; }
/** * Returns encoded polynomial, i.e., this polynomial in byte array form * * @return the encoded polynomial */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] res = new byte[coefficients.length * count]; count = 0; for (int i = 0; i < coefficients.length; i++) { for (int j = 0; j < d; j += 8) { res[count++] = (byte)(coefficients[i] >>> j); } } return res; }
/** * @return a byte array encoding of this matrix */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] bf = new byte[this.numRows * this.numColumns * count + 4]; bf[0] = (byte)(this.numRows & 0xff); bf[1] = (byte)((this.numRows >>> 8) & 0xff); bf[2] = (byte)((this.numRows >>> 16) & 0xff); bf[3] = (byte)((this.numRows >>> 24) & 0xff); count = 4; for (int i = 0; i < this.numRows; i++) { for (int j = 0; j < this.numColumns; j++) { for (int jj = 0; jj < d; jj += 8) { bf[count++] = (byte)(matrix[i][j] >>> jj); } } } return bf; }
/** * @return a byte array encoding of this matrix */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] bf = new byte[this.numRows * this.numColumns * count + 4]; bf[0] = (byte)(this.numRows & 0xff); bf[1] = (byte)((this.numRows >>> 8) & 0xff); bf[2] = (byte)((this.numRows >>> 16) & 0xff); bf[3] = (byte)((this.numRows >>> 24) & 0xff); count = 4; for (int i = 0; i < this.numRows; i++) { for (int j = 0; j < this.numColumns; j++) { for (int jj = 0; jj < d; jj += 8) { bf[count++] = (byte)(matrix[i][j] >>> jj); } } } return bf; }
/** * @return a byte array encoding of this matrix */ public byte[] getEncoded() { int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } byte[] bf = new byte[this.numRows * this.numColumns * count + 4]; bf[0] = (byte)(this.numRows & 0xff); bf[1] = (byte)((this.numRows >>> 8) & 0xff); bf[2] = (byte)((this.numRows >>> 16) & 0xff); bf[3] = (byte)((this.numRows >>> 24) & 0xff); count = 4; for (int i = 0; i < this.numRows; i++) { for (int j = 0; j < this.numColumns; j++) { for (int jj = 0; jj < d; jj += 8) { bf[count++] = (byte)(matrix[i][j] >>> jj); } } } return bf; }
/** * Constructor. * * @param field a finite field GF(2^m) * @param enc byte[] matrix in byte array form */ public GF2mMatrixEx(GF2mField field, int m, int n) { this.field = field; // decode matrix int d = 8; int count = 1; while (field.getDegree() > d) { count++; d += 8; } this.numRows = m; this.numColumns = n; this.matrix = new int[this.numRows][this.numColumns]; for(int i=0; i<numRows; i++){ Arrays.fill(this.matrix[i], 0); } }
/** * @return a human readable form of this vector */ public String toString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < vector.length; i++) { for (int j = 0; j < field.getDegree(); j++) { int r = j & 0x1f; int bitMask = 1 << r; int coeff = vector[i] & bitMask; if (coeff != 0) { buf.append('1'); } else { buf.append('0'); } } buf.append(' '); } return buf.toString(); }
/** * @return a human readable form of this vector */ public String toString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < vector.length; i++) { for (int j = 0; j < field.getDegree(); j++) { int r = j & 0x1f; int bitMask = 1 << r; int coeff = vector[i] & bitMask; if (coeff != 0) { buf.append('1'); } else { buf.append('0'); } } buf.append(' '); } return buf.toString(); }
while (field.getDegree() > d)
while (field.getDegree() > d)
while (field.getDegree() > d)
while (field.getDegree() > d)
while (field.getDegree() > d)
while (field.getDegree() > d)
int[] u = {0, 1}; final int[] Y = {0, 1}; int fieldDegree = field.getDegree(); for (int i = 0; i < d; i++)
int[] u = {0, 1}; final int[] Y = {0, 1}; int fieldDegree = field.getDegree(); for (int i = 0; i < d; i++)