Top Description Inners Fields Constructors Methods
org.bouncycastle.pqc.legacy.math.ntru.polynomial

public Class IntegerPolynomial

extends Object
implements Polynomial
Class Inheritance
All Implemented Interfaces
org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial
Known Direct Subclasses
org.bouncycastle.pqc.legacy.math.ntru.polynomial.DenseTernaryPolynomial
Imports
java.io.IOException, .InputStream, java.math.BigInteger, java.util.ArrayList, .Iterator, .LinkedList, .List, java.util.concurrent.Callable, .ExecutorService, .Executors, .Future, .LinkedBlockingQueue, org.bouncycastle.pqc.legacy.math.ntru.euclid.BigIntEuclidean, org.bouncycastle.pqc.legacy.math.ntru.util.ArrayEncoder, .Util, org.bouncycastle.util.Arrays

A polynomial with int coefficients.
Some methods (like add) change the polynomial, others (like mult) do not but return the result as a new polynomial.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
IntegerPolynomial.CombineTask

Calls {@link ModularResultant#combineRho(ModularResultant, ModularResultant)

private class
IntegerPolynomial.ModResultantTask

Calls {@link IntegerPolynomial#resultant(int)

private static class

Field Summary

Modifier and TypeField and Description
private static final List<E>
public int[]
private static final int
private static final int[]
PRIMES

Prime numbers > 4500 for resultant computation.

Constructor Summary

AccessConstructor and Description
public
IntegerPolynomial(int
the number of coefficients
N
)

Constructs a new polynomial with N coefficients initialized to 0.

public
IntegerPolynomial(int[]
the coefficients
coeffs
)

Constructs a new polynomial with a given set of coefficients.

public
IntegerPolynomial(BigIntPolynomial
the original polynomial
p
)

Constructs a IntegerPolynomial from a BigIntPolynomial.

Method Summary

Modifier and TypeMethod and Description
public void
add(IntegerPolynomial
another polynomial
b
,
int modulus)

Adds another polynomial which can have a different number of coefficients, and takes the coefficient values mod modulus.

public void
add(IntegerPolynomial
another polynomial
b
)

Adds another polynomial which can have a different number of coefficients.

public void
center0(int
a modulus
q
)

Shifts the values of all coefficients to the interval [-q/2, q/2].

public long

Returns:

the centered norm
centeredNormSq
(int
a modulus
q
)

Computes the centered euclidean norm of the polynomial.

public void
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public int

Returns:

the number of coefficients equal to value
count
(int
an integer
value
)

Counts the number of coefficients equal to an integer

pack-priv int

Returns:

the degree
degree
()

Returns the degree of the polynomial

public void
div(int
the divisor
k
)

Divides each coefficient by k and rounds to the nearest integer.

public void
ensurePositive(int
a modulus
modulus
)

Adds modulus until all coefficients are above 0.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private boolean

Returns:

true iff all coefficients are equal to zero, except for the lowest coefficient which must equal 1 or -1
equalsAbsOne
()

Tests if |p(x)| = 1.

public boolean

Returns:

true iff all coefficients are equal to zero, except for the lowest coefficient which must equal 1
equalsOne
()

Tests if p(x) = 1.

private boolean

Returns:

true iff all coefficients are zeros
equalsZero
()

Tests if p(x) = 0.

public static IntegerPolynomial

Returns:

the decoded polynomial
fromBinary
(byte[]
an encoded ternary polynomial
data
,
int
number of coefficients
N
,
int q)

Returns a polynomial with N coefficients between 0 and q-1.

public static IntegerPolynomial

Returns:

the decoded polynomial
fromBinary
(InputStream
an encoded ternary polynomial
is
,
int
number of coefficients
N
,
int q)

Returns a polynomial with N coefficients between 0 and q-1.

public static IntegerPolynomial

Returns:

the decoded polynomial
fromBinary3Sves
(byte[]
an encoded ternary polynomial
data
,
int
number of coefficients
N
)

Decodes a byte array to a polynomial with N ternary coefficients Ignores any excess bytes.

public static IntegerPolynomial

Returns:

the decoded polynomial
fromBinary3Tight
(byte[]
a byte array
b
,
int
number of coefficients
N
)

Converts a byte array produced by toBinary3Tight() to a polynomial.

public static IntegerPolynomial

Returns:

the decoded polynomial
fromBinary3Tight
(InputStream
an input stream
is
,
int
number of coefficients
N
)

Reads data produced by toBinary3Tight() from an input stream and converts it to a polynomial.

public IntegerPolynomial

Returns:

a new polynomial
invertF3
()

Computes the inverse mod 3.

public IntegerPolynomial

Returns:

a new polynomial
invertFq
(int
the modulus
q
)

Computes the inverse mod q; q must be a power of 2.

public void
mod(int modulus)

Takes each coefficient modulo modulus.

private IntegerPolynomial

Returns:

The inverse of this polynomial mod q
mod2ToModq
(IntegerPolynomial Fq, int q)

Computes the inverse mod q from the inverse mod 2

public void
mod3()

Takes each coefficient modulo 3 such that all coefficients are ternary.

pack-priv void
modCenter(int modulus)

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

public void
modPositive(int
a modulus
modulus
)

Ensures all coefficients are between 0 and modulus-1

public IntegerPolynomial
mult(IntegerPolynomial
a polynomial
poly2
,
int
a modulus to apply
modulus
)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

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

public IntegerPolynomial
mult(IntegerPolynomial
a polynomial
poly2
)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

Multiplies the polynomial with another, taking the indices mod N

public BigIntPolynomial
mult(BigIntPolynomial
the polynomial to multiply by
poly2
)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

Multiplies the polynomial by a BigIntPolynomial, taking the indices mod N.

public void
mult(int factor)

Multiplies each coefficient by a int.

private void
mult2(int
a modulus
modulus
)

Multiplies each coefficient by a 2 and applies a modulus.

public void
mult3(int
a modulus
modulus
)

Multiplies each coefficient by a 2 and applies a modulus.

private IntegerPolynomial
multRecursive(IntegerPolynomial poly2)

Karazuba multiplication

private void
multShiftSub(IntegerPolynomial b, int c, int k, int p)

Computes this-b*c*(x^k) mod p and stores the result in this polynomial.

public Resultant

Returns:

(rho, res) satisfying res = rho*this + t*(x^n-1) for some integer t.
resultant
()

Resultant of this polynomial with x^n-1 using a probabilistic algorithm.

public ModularResultant

Returns:

(rho, res) satisfying res = rho*this + t*(x^n-1) mod p for some integer t.
resultant
(int p)

Resultant of this polynomial with x^n-1 mod p.

public Resultant

Returns:

(rho, res) satisfying res = rho*this + t*(x^n-1) for some integer t.
resultantMultiThread
()

Multithreaded version of resultant().

public void
rotate1()

Multiplication by X in Z[X]/Z[X^n-1].

pack-priv void
shiftGap(int
a modulus
q
)

Shifts all coefficients so the largest gap is centered around -q/2.

private void
sort(int[] ints)

private BigInteger

Returns:

the sum of squares
squareSum
()

Adds the squares of all coefficients.

public void
sub(IntegerPolynomial
another polynomial
b
,
int modulus)

Subtracts another polynomial which can have a different number of coefficients, and takes the coefficient values mod modulus.

public void
sub(IntegerPolynomial
another polynomial
b
)

Subtracts another polynomial which can have a different number of coefficients.

pack-priv void
sub(int b)

Subtracts a int from each coefficient.

public int

Returns:

the sum of all coefficients
sumCoeffs
()

Returns the sum of all coefficients, i.e. evaluates the polynomial at 0.

public byte[]

Returns:

the encoded polynomial
toBinary
(int q)

Encodes a polynomial whose coefficients are between 0 and q, to binary.

public byte[]

Returns:

the encoded polynomial
toBinary3Sves
()

Encodes a polynomial with ternary coefficients to binary.

public byte[]

Returns:

the encoded polynomial
toBinary3Tight
()

Converts a polynomial with ternary coefficients to binary.

public IntegerPolynomial
toIntegerPolynomial()

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.toIntegerPolynomial.

Returns a polynomial that is equal to this polynomial (in the sense that mult(IntegerPolynomial, int) returns equal IntegerPolynomials).

Inherited from java.lang.Object:
finalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BIGINT_PRIMESback to summary
private static final List<E> BIGINT_PRIMES
coeffsback to summary
public int[] coeffs
NUM_EQUAL_RESULTANTSback to summary
private static final int NUM_EQUAL_RESULTANTS
PRIMESback to summary
private static final int[] PRIMES

Prime numbers > 4500 for resultant computation. Starting them below ~4400 causes incorrect results occasionally. Fortunately, 4500 is about the optimum number for performance.
This array contains enough prime numbers so primes never have to be computed on-line for any standard org.bouncycastle.pqc.legacy.crypto.ntru.NTRUSigningParameters.

Constructor Detail

IntegerPolynomialback to summary
public IntegerPolynomial(int N)

Constructs a new polynomial with N coefficients initialized to 0.

Parameters
N:int

the number of coefficients

IntegerPolynomialback to summary
public IntegerPolynomial(int[] coeffs)

Constructs a new polynomial with a given set of coefficients.

Parameters
coeffs:int[]

the coefficients

IntegerPolynomialback to summary
public IntegerPolynomial(BigIntPolynomial p)

Constructs a IntegerPolynomial from a BigIntPolynomial. The two polynomials are independent of each other.

Parameters
p:BigIntPolynomial

the original polynomial

Method Detail

addback to summary
public void add(IntegerPolynomial b, int modulus)

Adds another polynomial which can have a different number of coefficients, and takes the coefficient values mod modulus.

Parameters
b:IntegerPolynomial

another polynomial

addback to summary
public void add(IntegerPolynomial b)

Adds another polynomial which can have a different number of coefficients.

Parameters
b:IntegerPolynomial

another polynomial

center0back to summary
public void center0(int q)

Shifts the values of all coefficients to the interval [-q/2, q/2].

Parameters
q:int

a modulus

centeredNormSqback to summary
public long centeredNormSq(int q)

Computes the centered euclidean norm of the polynomial.

Parameters
q:int

a modulus

Returns:long

the centered norm

clearback to summary
public void clear()
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

countback to summary
public int count(int value)

Counts the number of coefficients equal to an integer

Parameters
value:int

an integer

Returns:int

the number of coefficients equal to value

degreeback to summary
pack-priv int degree()

Returns the degree of the polynomial

Returns:int

the degree

divback to summary
public void div(int k)

Divides each coefficient by k and rounds to the nearest integer. Does not return a new polynomial but modifies this polynomial.

Parameters
k:int

the divisor

ensurePositiveback to summary
public void ensurePositive(int modulus)

Adds modulus until all coefficients are above 0.

Parameters
modulus:int

a modulus

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

equalsAbsOneback to summary
private boolean equalsAbsOne()

Tests if |p(x)| = 1.

Returns:boolean

true iff all coefficients are equal to zero, except for the lowest coefficient which must equal 1 or -1

equalsOneback to summary
public boolean equalsOne()

Tests if p(x) = 1.

Returns:boolean

true iff all coefficients are equal to zero, except for the lowest coefficient which must equal 1

equalsZeroback to summary
private boolean equalsZero()

Tests if p(x) = 0.

Returns:boolean

true iff all coefficients are zeros

fromBinaryback to summary
public static IntegerPolynomial fromBinary(byte[] data, int N, int q)

Returns a polynomial with N coefficients between 0 and q-1.
q must be a power of 2.
Ignores any excess bytes.

Parameters
data:byte[]

an encoded ternary polynomial

N:int

number of coefficients

Returns:IntegerPolynomial

the decoded polynomial

fromBinaryback to summary
public static IntegerPolynomial fromBinary(InputStream is, int N, int q) throws IOException

Returns a polynomial with N coefficients between 0 and q-1.
q must be a power of 2.
Ignores any excess bytes.

Parameters
is:InputStream

an encoded ternary polynomial

N:int

number of coefficients

Returns:IntegerPolynomial

the decoded polynomial

fromBinary3Svesback to summary
public static IntegerPolynomial fromBinary3Sves(byte[] data, int N)

Decodes a byte array to a polynomial with N ternary coefficients
Ignores any excess bytes.

Parameters
data:byte[]

an encoded ternary polynomial

N:int

number of coefficients

Returns:IntegerPolynomial

the decoded polynomial

fromBinary3Tightback to summary
public static IntegerPolynomial fromBinary3Tight(byte[] b, int N)

Converts a byte array produced by toBinary3Tight() to a polynomial.

Parameters
b:byte[]

a byte array

N:int

number of coefficients

Returns:IntegerPolynomial

the decoded polynomial

fromBinary3Tightback to summary
public static IntegerPolynomial fromBinary3Tight(InputStream is, int N) throws IOException

Reads data produced by toBinary3Tight() from an input stream and converts it to a polynomial.

Parameters
is:InputStream

an input stream

N:int

number of coefficients

Returns:IntegerPolynomial

the decoded polynomial

invertF3back to summary
public IntegerPolynomial invertF3()

Computes the inverse mod 3. Returns null if the polynomial is not invertible.

Returns:IntegerPolynomial

a new polynomial

invertFqback to summary
public IntegerPolynomial invertFq(int q)

Computes the inverse mod q; q must be a power of 2.
Returns null if the polynomial is not invertible.

Parameters
q:int

the modulus

Returns:IntegerPolynomial

a new polynomial

modback to summary
public void mod(int modulus)

Takes each coefficient modulo modulus.

mod2ToModqback to summary
private IntegerPolynomial mod2ToModq(IntegerPolynomial Fq, int q)

Computes the inverse mod q from the inverse mod 2

Returns:IntegerPolynomial

The inverse of this polynomial mod q

mod3back to summary
public void mod3()

Takes each coefficient modulo 3 such that all coefficients are ternary.

modCenterback to summary
pack-priv void modCenter(int modulus)

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

modPositiveback to summary
public void modPositive(int modulus)

Ensures all coefficients are between 0 and modulus-1

Parameters
modulus:int

a modulus

multback to summary
public IntegerPolynomial mult(IntegerPolynomial poly2, int modulus)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

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

Parameters
poly2:IntegerPolynomial

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

a polynomial

modulus:int

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

a modulus to apply

Returns:IntegerPolynomial

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

the product of the two polynomials

multback to summary
public IntegerPolynomial mult(IntegerPolynomial poly2)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

Multiplies the polynomial with another, taking the indices mod N

Parameters
poly2:IntegerPolynomial

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

a polynomial

Returns:IntegerPolynomial

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

the product of the two polynomials

multback to summary
public BigIntPolynomial mult(BigIntPolynomial poly2)

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.mult.

Multiplies the polynomial by a BigIntPolynomial, taking the indices mod N. Does not change this polynomial but returns the result as a new polynomial.
Both polynomials must have the same number of coefficients.

Parameters
poly2:BigIntPolynomial

the polynomial to multiply by

Returns:BigIntPolynomial

a new polynomial

multback to summary
public void mult(int factor)

Multiplies each coefficient by a int. Does not return a new polynomial but modifies this polynomial.

mult2back to summary
private void mult2(int modulus)

Multiplies each coefficient by a 2 and applies a modulus. Does not return a new polynomial but modifies this polynomial.

Parameters
modulus:int

a modulus

mult3back to summary
public void mult3(int modulus)

Multiplies each coefficient by a 2 and applies a modulus. Does not return a new polynomial but modifies this polynomial.

Parameters
modulus:int

a modulus

multRecursiveback to summary
private IntegerPolynomial multRecursive(IntegerPolynomial poly2)

Karazuba multiplication

multShiftSubback to summary
private void multShiftSub(IntegerPolynomial b, int c, int k, int p)

Computes this-b*c*(x^k) mod p and stores the result in this polynomial.
See steps 4a,4b in EESS algorithm 2.2.7.1.

resultantback to summary
public Resultant resultant()

Resultant of this polynomial with x^n-1 using a probabilistic algorithm.

Unlike EESS, this implementation does not compute all resultants modulo primes such that their product exceeds the maximum possible resultant, but rather stops when NUM_EQUAL_RESULTANTS consecutive modular resultants are equal.
This means the return value may be incorrect. Experiments show this happens in about 1 out of 100 cases when N=439 and NUM_EQUAL_RESULTANTS=2, so the likelyhood of leaving the loop too early is (1/100)^(NUM_EQUAL_RESULTANTS-1).

Because of the above, callers must verify the output and try a different polynomial if necessary.

Returns:Resultant

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

resultantback to summary
public ModularResultant resultant(int p)

Resultant of this polynomial with x^n-1 mod p.

Returns:ModularResultant

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

resultantMultiThreadback to summary
public Resultant resultantMultiThread()

Multithreaded version of resultant().

Returns:Resultant

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

rotate1back to summary
public void rotate1()

Multiplication by X in Z[X]/Z[X^n-1].

shiftGapback to summary
pack-priv void shiftGap(int q)

Shifts all coefficients so the largest gap is centered around -q/2.

Parameters
q:int

a modulus

sortback to summary
private void sort(int[] ints)
squareSumback to summary
private BigInteger squareSum()

Adds the squares of all coefficients.

Returns:BigInteger

the sum of squares

subback to summary
public void sub(IntegerPolynomial b, int modulus)

Subtracts another polynomial which can have a different number of coefficients, and takes the coefficient values mod modulus.

Parameters
b:IntegerPolynomial

another polynomial

subback to summary
public void sub(IntegerPolynomial b)

Subtracts another polynomial which can have a different number of coefficients.

Parameters
b:IntegerPolynomial

another polynomial

subback to summary
pack-priv void sub(int b)

Subtracts a int from each coefficient. Does not return a new polynomial but modifies this polynomial.

sumCoeffsback to summary
public int sumCoeffs()

Returns the sum of all coefficients, i.e. evaluates the polynomial at 0.

Returns:int

the sum of all coefficients

toBinaryback to summary
public byte[] toBinary(int q)

Encodes a polynomial whose coefficients are between 0 and q, to binary. q must be a power of 2.

Returns:byte[]

the encoded polynomial

toBinary3Svesback to summary
public byte[] toBinary3Sves()

Encodes a polynomial with ternary coefficients to binary. coeffs[2*i] and coeffs[2*i+1] must not both equal -1 for any integer i, so this method is only safe to use with polynomials produced by fromBinary3Sves().

Returns:byte[]

the encoded polynomial

toBinary3Tightback to summary
public byte[] toBinary3Tight()

Converts a polynomial with ternary coefficients to binary.

Returns:byte[]

the encoded polynomial

toIntegerPolynomialback to summary
public IntegerPolynomial toIntegerPolynomial()

Implements org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.toIntegerPolynomial.

Doc from org.bouncycastle.pqc.legacy.math.ntru.polynomial.Polynomial.toIntegerPolynomial.

Returns a polynomial that is equal to this polynomial (in the sense that mult(IntegerPolynomial, int) returns equal IntegerPolynomials). The new polynomial is guaranteed to be independent of the original.

Returns:IntegerPolynomial

a new IntegerPolynomial.

org.bouncycastle.pqc.legacy.math.ntru.polynomial back to summary

private Class IntegerPolynomial.CombineTask

extends Object
implements Callable<ModularResultant>
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.pqc.legacy.math.ntru.polynomial.IntegerPolynomial.CombineTask
All Implemented Interfaces
java.util.concurrent.Callable

Calls {@link ModularResultant#combineRho(ModularResultant, ModularResultant)

Field Summary

Modifier and TypeField and Description
private ModularResultant
private ModularResultant

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ModularResultant
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

modRes1back to summary
private ModularResultant modRes1
modRes2back to summary
private ModularResultant modRes2

Constructor Detail

CombineTaskback to summary
private CombineTask(ModularResultant modRes1, ModularResultant modRes2)

Method Detail

callback to summary
public ModularResultant call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:ModularResultant

computed result

org.bouncycastle.pqc.legacy.math.ntru.polynomial back to summary

private Class IntegerPolynomial.ModResultantTask

extends Object
implements Callable<ModularResultant>
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.pqc.legacy.math.ntru.polynomial.IntegerPolynomial.ModResultantTask
All Implemented Interfaces
java.util.concurrent.Callable

Calls {@link IntegerPolynomial#resultant(int)

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
private
ModResultantTask(int modulus)

Method Summary

Modifier and TypeMethod and Description
public ModularResultant
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

modulusback to summary
private int modulus

Constructor Detail

ModResultantTaskback to summary
private ModResultantTask(int modulus)

Method Detail

callback to summary
public ModularResultant call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:ModularResultant

computed result

org.bouncycastle.pqc.legacy.math.ntru.polynomial back to summary

private Class IntegerPolynomial.PrimeGenerator

extends Object
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.pqc.legacy.math.ntru.polynomial.IntegerPolynomial.PrimeGenerator

Field Summary

Modifier and TypeField and Description
private int
private BigInteger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public BigInteger
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private int index
primeback to summary
private BigInteger prime

Constructor Detail

PrimeGeneratorback to summary
private PrimeGenerator()

Method Detail

nextPrimeback to summary
public BigInteger nextPrime()