Class ProductFormPolynomial
- java.lang.Object
-
- org.bouncycastle.pqc.math.ntru.polynomial.ProductFormPolynomial
-
- All Implemented Interfaces:
Polynomial
public class ProductFormPolynomial extends java.lang.Object implements Polynomial
A polynomial of the formf1*f2+f3, wheref1,f2,f3are very sparsely populated ternary polynomials.
-
-
Constructor Summary
Constructors Constructor Description ProductFormPolynomial(SparseTernaryPolynomial f1, SparseTernaryPolynomial f2, SparseTernaryPolynomial f3)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)static ProductFormPolynomialfromBinary(byte[] data, int N, int df1, int df2, int df3Ones, int df3NegOnes)static ProductFormPolynomialfromBinary(java.io.InputStream is, int N, int df1, int df2, int df3Ones, int df3NegOnes)static ProductFormPolynomialgenerateRandom(int N, int df1, int df2, int df3Ones, int df3NegOnes, java.security.SecureRandom random)inthashCode()BigIntPolynomialmult(BigIntPolynomial b)Multiplies the polynomial by aBigIntPolynomial, taking the indices mod N.IntegerPolynomialmult(IntegerPolynomial b)Multiplies the polynomial by anIntegerPolynomial, taking the indices modN.IntegerPolynomialmult(IntegerPolynomial poly2, int modulus)Multiplies the polynomial by anIntegerPolynomial, taking the coefficient values modmodulusand the indices modN.byte[]toBinary()IntegerPolynomialtoIntegerPolynomial()Returns a polynomial that is equal to this polynomial (in the sense thatPolynomial.mult(IntegerPolynomial, int)returns equalIntegerPolynomials).
-
-
-
Constructor Detail
-
ProductFormPolynomial
public ProductFormPolynomial(SparseTernaryPolynomial f1, SparseTernaryPolynomial f2, SparseTernaryPolynomial f3)
-
-
Method Detail
-
generateRandom
public static ProductFormPolynomial generateRandom(int N, int df1, int df2, int df3Ones, int df3NegOnes, java.security.SecureRandom random)
-
fromBinary
public static ProductFormPolynomial fromBinary(byte[] data, int N, int df1, int df2, int df3Ones, int df3NegOnes) throws java.io.IOException
- Throws:
java.io.IOException
-
fromBinary
public static ProductFormPolynomial fromBinary(java.io.InputStream is, int N, int df1, int df2, int df3Ones, int df3NegOnes) throws java.io.IOException
- Throws:
java.io.IOException
-
toBinary
public byte[] toBinary()
-
mult
public IntegerPolynomial mult(IntegerPolynomial b)
Description copied from interface:PolynomialMultiplies the polynomial by anIntegerPolynomial, taking the indices modN.- Specified by:
multin interfacePolynomial- Parameters:
b- a polynomial- Returns:
- the product of the two polynomials
-
mult
public BigIntPolynomial mult(BigIntPolynomial b)
Description copied from interface:PolynomialMultiplies the polynomial by aBigIntPolynomial, 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.- Specified by:
multin interfacePolynomial- Parameters:
b- the polynomial to multiply by- Returns:
- a new polynomial
-
toIntegerPolynomial
public IntegerPolynomial toIntegerPolynomial()
Description copied from interface:PolynomialReturns a polynomial that is equal to this polynomial (in the sense thatPolynomial.mult(IntegerPolynomial, int)returns equalIntegerPolynomials). The new polynomial is guaranteed to be independent of the original.- Specified by:
toIntegerPolynomialin interfacePolynomial- Returns:
- a new
IntegerPolynomial.
-
mult
public IntegerPolynomial mult(IntegerPolynomial poly2, int modulus)
Description copied from interface:PolynomialMultiplies the polynomial by anIntegerPolynomial, taking the coefficient values modmodulusand the indices modN.- Specified by:
multin interfacePolynomial- Parameters:
poly2- a polynomialmodulus- a modulus to apply- Returns:
- the product of the two polynomials
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-