Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.ntru
Class IntegerPolynomial

    java.lang.Object
      net.sf.ntru.IntegerPolynomial

     class IntegerPolynomial

extends java.lang.Object

Field Summary
`(package private) static int[]` | `BIT1_TABLE` http://stackoverflow.com/questions/1562548/how-to-make-a-message-into-a-polynomial Convert each set of two ternary coefficients to three bits as follows, and concatenate the resulting bit quantities to obtain [the output]: {-1, -1} -> set "fail" to 1 and set bit string to {1, 1, 1} {-1, 0} -> {1, 1, 0} {-1, 1} -> {1, 1, 1} {0, -1} -> {0, 1, 0} {0, 0} -> {0, 0, 0} {0, 1} -> {0, 0, 1} {1, -1} -> {1, 0, 1} {1, 0} -> {0, 1, 1} {1, 1} -> {1, 0, 0}
`(package private) static int[]` | `BIT2_TABLE`
`(package private) static int[]` | `BIT3_TABLE`
`(package private) static int[]` | `COEFF1_TABLE` http://stackoverflow.com/questions/1562548/how-to-make-a-message-into-a-polynomial Convert each three-bit quantity to two ternary coefficients as follows, and concatenate the resulting ternary quantities to obtain [the output]
`(package private) static int[]` | `COEFF2_TABLE`
`(package private) int[]` | `coeffs`
`private static java.util.List<java.math.BigInteger>` | `PRIMES`

Constructor Summary
`IntegerPolynomial(BigIntPolynomial p)`
`IntegerPolynomial(int N)`
`IntegerPolynomial(int[] coeffs)`

Method Summary
`(package private) void` | `add(IntegerPolynomial b)` Adds another polynomial which can have a different number of coefficients
`(package private) void` | `add(IntegerPolynomial b, int modulus)`
`(package private) void` | `center0(int q)`
`(package private) void` | `centerN(int A, int q)`
`(package private) int` | `centerNormSq(int modulus)` Centered norm (inefficient algorithm)
`(package private) void` | `clear()`
`IntegerPolynomial` | `clone()`
`(package private) int` | `count(int value)`
`(package private) int` | `degree()`
`(package private) void` | `div(int k)` divides by k and rounds to the nearest integer
`(package private) void` | `ensurePositive(int modulus)`
`boolean` | `equals(java.lang.Object obj)`
`private boolean` | `equalsAbsOne()`
`(package private) boolean` | `equalsOne()`
`private boolean` | `equalsZero()`
`(package private) static IntegerPolynomial` | `fromBinary(byte[] data, int N, int q)`
`(package private) static IntegerPolynomial` | `fromBinary(java.nio.ByteBuffer buf, int N, int q)`
`(package private) static IntegerPolynomial` | `fromBinary3(byte[] data, int N)`
`(package private) static IntegerPolynomial` | `fromBinary3Arith(byte[] b, int N)`
`(package private) static IntegerPolynomial` | `fromBinary3Arith(java.nio.ByteBuffer buf, int N)`
`(package private) static IntegerPolynomial` | `generateRandom(int N)`
`(package private) static IntegerPolynomial` | `generateRandomSmall(int N, int numOnes, int numNegOnes)`
`private static int` | `getBit(byte[] arr, int bitIndex)`
`(package private) IntegerPolynomial` | `invertF3()`
`(package private) IntegerPolynomial` | `invertFq(int q)`
`(package private) void` | `mod(int modulus)`
`(package private) void` | `mod3()`
`(package private) void` | `modCenter(int modulus)` Reduces all coefficients to the interval [-modulus/2, modulus/2)
`(package private) void` | `modPositive(int modulus)`
`(package private) void` | `mult(int factor)`
`(package private) IntegerPolynomial` | `mult(IntegerPolynomial poly2)` Multiplies the polynomial with another, taking the indices mod N
`(package private) IntegerPolynomial` | `mult(IntegerPolynomial poly2, int modulus)` Multiplies the polynomial with another, taking the values mod modulus and the indices mod N
`private void` | `mult2(int modulus)`
`(package private) void` | `mult3(int modulus)`
`(package private) void` | `mult3Add1(int modulus)`
`(package private) Resultant` | `resultant()` Resultant of this polynomial with x^n-1.
`(package private) Resultant` | `resultant(int p)` Resultant of this polynomial with x^n-1 mod p.
`(package private) void` | `rotate1()`
`(package private) void` | `shift(int k)`
`private java.math.BigInteger` | `squareSum()`
`(package private) void` | `sub(int b)`
`(package private) void` | `sub(IntegerPolynomial b)` Subtracts another polynomial which can have a different number of coefficients
`(package private) void` | `sub(IntegerPolynomial b, int modulus)`
`(package private) int` | `sumCoeffs()`
`(package private) byte[]` | `toBinary(int q)`
`(package private) byte[]` | `toBinary3()`
`(package private) byte[]` | `toBinary3Arith()`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### COEFF1_TABLE

    static final int[] COEFF1_TABLE

  http://stackoverflow.com/questions/1562548/how-to-make-a-message-into-a-polynomial Convert each three-bit quantity to two ternary coefficients as follows, and concatenate the resulting ternary quantities to obtain [the output]. {0, 0, 0} -> {0, 0} {0, 0, 1} -> {0, 1} {0, 1, 0} -> {0, -1} {0, 1, 1} -> {1, 0} {1, 0, 0} -> {1, 1} {1, 0, 1} -> {1, -1} {1, 1, 0} -> {-1, 0} {1, 1, 1} -> {-1, 1}

### COEFF2_TABLE

    static final int[] COEFF2_TABLE

### BIT1_TABLE

    static final int[] BIT1_TABLE

  http://stackoverflow.com/questions/1562548/how-to-make-a-message-into-a-polynomial Convert each set of two ternary coefficients to three bits as follows, and concatenate the resulting bit quantities to obtain [the output]: {-1, -1} -> set "fail" to 1 and set bit string to {1, 1, 1} {-1, 0} -> {1, 1, 0} {-1, 1} -> {1, 1, 1} {0, -1} -> {0, 1, 0} {0, 0} -> {0, 0, 0} {0, 1} -> {0, 0, 1} {1, -1} -> {1, 0, 1} {1, 0} -> {0, 1, 1} {1, 1} -> {1, 0, 0}

### BIT2_TABLE

    static final int[] BIT2_TABLE

### BIT3_TABLE

    static final int[] BIT3_TABLE

### PRIMES

    private static final java.util.List<java.math.BigInteger> PRIMES

### coeffs

    int[] coeffs

Constructor Detail

### IntegerPolynomial

    IntegerPolynomial(int N)

### IntegerPolynomial

    IntegerPolynomial(int[] coeffs)

### IntegerPolynomial

    IntegerPolynomial(BigIntPolynomial p)

Method Detail

### fromBinary3

    static IntegerPolynomial fromBinary3(byte[] data,
                                         int N)

### fromBinary

    static IntegerPolynomial fromBinary(byte[] data,
                                        int N,
                                        int q)

### fromBinary

    static IntegerPolynomial fromBinary(java.nio.ByteBuffer buf,
                                        int N,
                                        int q)

### getBit

    private static int getBit(byte[] arr,
                              int bitIndex)

### toBinary3

    byte[] toBinary3()

### toBinary3Arith

    byte[] toBinary3Arith()

### fromBinary3Arith

    static IntegerPolynomial fromBinary3Arith(byte[] b,
                                              int N)

### fromBinary3Arith

    static IntegerPolynomial fromBinary3Arith(java.nio.ByteBuffer buf,
                                              int N)

### toBinary

    byte[] toBinary(int q)

### generateRandomSmall

    static IntegerPolynomial generateRandomSmall(int N,
                                                 int numOnes,
                                                 int numNegOnes)

### generateRandom

    static IntegerPolynomial generateRandom(int N)

### mult

    IntegerPolynomial mult(IntegerPolynomial poly2,
                           int modulus)

  Multiplies the polynomial with another, taking the values mod modulus and the indices mod N

### mult

    IntegerPolynomial mult(IntegerPolynomial poly2)

  Multiplies the polynomial with another, taking the indices mod N

### invertFq

    IntegerPolynomial invertFq(int q)

### invertF3

    IntegerPolynomial invertF3()

### resultant

    Resultant resultant()

  Resultant of this polynomial with x^n-1. Returns (rho, res) satisfying res = rho*this + t*(x^n-1) for some integer t

### resultant

    Resultant resultant(int p)

  Resultant of this polynomial with x^n-1 mod p. Returns (rho, res) satisfying res = rho*this + t*(x^n-1) mod p for some integer t.

### squareSum

    private java.math.BigInteger squareSum()

### degree

    int degree()

### add

    void add(IntegerPolynomial b,
             int modulus)

### add

    void add(IntegerPolynomial b)

  Adds another polynomial which can have a different number of coefficients

### sub

    void sub(IntegerPolynomial b,
             int modulus)

### sub

    void sub(IntegerPolynomial b)

  Subtracts another polynomial which can have a different number of coefficients

### sub

    void sub(int b)

### mult

    void mult(int factor)

### mult2

    private void mult2(int modulus)

### mult3

    void mult3(int modulus)

### mult3Add1

    void mult3Add1(int modulus)

### div

    void div(int k)

  divides by k and rounds to the nearest integer

### mod3

    void mod3()

### modPositive

    void modPositive(int modulus)

### modCenter

    void modCenter(int modulus)

  Reduces all coefficients to the interval [-modulus/2, modulus/2)

### mod

    void mod(int modulus)

### ensurePositive

    void ensurePositive(int modulus)

### shift

    void shift(int k)

### center0

    void center0(int q)

### centerN

    void centerN(int A,
                 int q)

### sumCoeffs

    int sumCoeffs()

### equalsZero

    private boolean equalsZero()

### equalsOne

    boolean equalsOne()

### equalsAbsOne

    private boolean equalsAbsOne()

### count

    int count(int value)

### centerNormSq

    int centerNormSq(int modulus)

  Centered norm (inefficient algorithm)

### rotate1

    void rotate1()

### clear

    void clear()

### clone

    public IntegerPolynomial clone()

  Overrides:
    `clone` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD