de.flexiprovider.common.math.quadraticfields
Class IQClassGroup

java.lang.Object
  |
  +--de.flexiprovider.common.math.quadraticfields.IQClassGroup

public class IQClassGroup
extends java.lang.Object


Constructor Summary
IQClassGroup(FlexiBigInt discriminant)
          Constructor.
IQClassGroup(FlexiBigInt discriminant, SecureRandom prng)
          Constructor.
IQClassGroup(int bits, boolean primeDiscriminant)
          Constructor.
IQClassGroup(int bits, boolean primeDiscriminant, SecureRandom prng)
          Constructor.
 
Method Summary
 QuadraticIdeal divide(QuadraticIdeal I1, QuadraticIdeal I2)
          Divide a quadratic ideal by another.
 FlexiBigInt getDiscriminant()
          Query discriminant of an IQClassGroup object.
 QuadraticIdeal invert(QuadraticIdeal I)
          Invert a quadratic ideal of the class group.
 boolean isOne(QuadraticIdeal I)
          Check whether the given ideal is the neutral element of the class group.
 boolean isReduced(QuadraticIdeal I)
          Check whether we have a reduced ideal already.
 boolean isValid(QuadraticIdeal I)
          discriminant = b^2 - 4ac, thus (b^2 - discriminant) mod 4a better be zero for c to be an integer.
 QuadraticIdeal multiply(FlexiBigInt a1, FlexiBigInt b1, FlexiBigInt a2, FlexiBigInt b2)
          Multiply two quadratic ideals of the class group.
 QuadraticIdeal multiply(QuadraticIdeal I1, QuadraticIdeal I2)
          Multiply two quadratic ideals.
 QuadraticIdeal one()
           
 QuadraticIdeal power(QuadraticIdeal[] powI, FlexiBigInt n)
          Exponentiate a quadratic ideal (uses signed-digit exponent recoding) This assumes we have precomputed an array of powers of the ideal (see Gordon-Brickell precomputation).
 QuadraticIdeal power(QuadraticIdeal I, FlexiBigInt n)
          Exponentiate a quadratic ideal (uses signed-digit exponent recoding).
 QuadraticIdeal[] precomputeGordonBrickell(QuadraticIdeal I, int n)
          Generate precomputed values for fast exponentation using the Gordon Brickell method.
 QuadraticIdeal[][] precomputeSimPowerWNAF(QuadraticIdeal[] g, int w)
           
 QuadraticIdeal primePowerIdeal(FlexiBigInt p, int e)
           
 QuadraticIdeal randomIdeal()
           
 QuadraticIdeal randomPrimePowerIdeal(int bits, int e)
           
 QuadraticIdeal reduce(QuadraticIdeal I)
          Reduce a quadratic ideal of the class group.
 QuadraticIdeal simPower(QuadraticIdeal[] I, FlexiBigInt[] n)
          Simultaneous power computation for <= 10 ideals and exponents.
 QuadraticIdeal simPowerWNAF(QuadraticIdeal[][] gLUT, FlexiBigInt[] e, int w)
           
 QuadraticIdeal square(FlexiBigInt a, FlexiBigInt b)
          Square a quadratic ideal.
 QuadraticIdeal square(QuadraticIdeal I)
          Square a quadratic ideal.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IQClassGroup

public IQClassGroup(FlexiBigInt discriminant,
                    SecureRandom prng)
Constructor.
Parameters:
discriminant - discriminant of class group
prng - instance of a pseudo-random number generator

IQClassGroup

public IQClassGroup(FlexiBigInt discriminant)
Constructor.
Parameters:
discriminant - discriminant of class group

IQClassGroup

public IQClassGroup(int bits,
                    boolean primeDiscriminant,
                    SecureRandom prng)
Constructor.
Parameters:
bits - length of the binary expansion of the discriminant
primeDiscriminant - flag to indicate whether the absolute value of the discriminant has to be a prime or not
prng - instance of pseudo-random number generator

IQClassGroup

public IQClassGroup(int bits,
                    boolean primeDiscriminant)
Constructor.
Parameters:
bits - length of the binary expension of the discriminant
primeDiscriminant - flag to indicate whether the absolute value of the discriminant has to be a prime or not
Method Detail

getDiscriminant

public FlexiBigInt getDiscriminant()
Query discriminant of an IQClassGroup object.
Returns:
discriminant of class group

isReduced

public boolean isReduced(QuadraticIdeal I)
Check whether we have a reduced ideal already.
Returns:
true if ideal is reduced, false otherwise.

isValid

public boolean isValid(QuadraticIdeal I)
discriminant = b^2 - 4ac, thus (b^2 - discriminant) mod 4a better be zero for c to be an integer.
Returns:
the result of the test (b^2 - discriminant) mod 4a == 0

reduce

public QuadraticIdeal reduce(QuadraticIdeal I)
Reduce a quadratic ideal of the class group.
Parameters:
I - ideal to be reduced
Returns:
reduced ideal equivalent to I

invert

public QuadraticIdeal invert(QuadraticIdeal I)
Invert a quadratic ideal of the class group.
Returns:
the inverse ideal

multiply

public QuadraticIdeal multiply(FlexiBigInt a1,
                               FlexiBigInt b1,
                               FlexiBigInt a2,
                               FlexiBigInt b2)
Multiply two quadratic ideals of the class group.
Returns:
the product of the two ideals

multiply

public QuadraticIdeal multiply(QuadraticIdeal I1,
                               QuadraticIdeal I2)
Multiply two quadratic ideals.
Returns:
the product of the two ideals

divide

public QuadraticIdeal divide(QuadraticIdeal I1,
                             QuadraticIdeal I2)
Divide a quadratic ideal by another.
Parameters:
I1 - the first ideal (dividend)
I2 - the second ideal (divisor)
Returns:
the remainder of the division

square

public QuadraticIdeal square(FlexiBigInt a,
                             FlexiBigInt b)
Square a quadratic ideal.
Returns:
the squared ideal

square

public QuadraticIdeal square(QuadraticIdeal I)
Square a quadratic ideal.
Returns:
the sqared ideal

one

public QuadraticIdeal one()
Returns:
the neutral element of the class group

isOne

public boolean isOne(QuadraticIdeal I)
Check whether the given ideal is the neutral element of the class group.
Parameters:
I - the ideal
Returns:
true if I is the neutral element of the class group, false otherwise

power

public QuadraticIdeal power(QuadraticIdeal I,
                            FlexiBigInt n)
Exponentiate a quadratic ideal (uses signed-digit exponent recoding).
Parameters:
I - the ideal
n - the exponent
Returns:
In

power

public QuadraticIdeal power(QuadraticIdeal[] powI,
                            FlexiBigInt n)
Exponentiate a quadratic ideal (uses signed-digit exponent recoding) This assumes we have precomputed an array of powers of the ideal (see Gordon-Brickell precomputation).
Parameters:
powI - the array of precomputed ideals (first element is base)
n - the exponent
Returns:
powI[0]n

precomputeGordonBrickell

public QuadraticIdeal[] precomputeGordonBrickell(QuadraticIdeal I,
                                                 int n)
Generate precomputed values for fast exponentation using the Gordon Brickell method.
Parameters:
I - the ideal
n - the number of ideals to precompute
Returns:
the array [I, I21, ..., I2n-1]

precomputeSimPowerWNAF

public QuadraticIdeal[][] precomputeSimPowerWNAF(QuadraticIdeal[] g,
                                                 int w)

simPowerWNAF

public QuadraticIdeal simPowerWNAF(QuadraticIdeal[][] gLUT,
                                   FlexiBigInt[] e,
                                   int w)

simPower

public QuadraticIdeal simPower(QuadraticIdeal[] I,
                               FlexiBigInt[] n)
Simultaneous power computation for <= 10 ideals and exponents.
Parameters:
I - the ideal array
n - the exponent array
Returns:
I[0]n[0] * ... * I[I.length-1]n[I.length-1], or one if I.length > 10 or I.length != n.length

primePowerIdeal

public QuadraticIdeal primePowerIdeal(FlexiBigInt p,
                                      int e)
                               throws NoQuadraticResidueException

randomPrimePowerIdeal

public QuadraticIdeal randomPrimePowerIdeal(int bits,
                                            int e)

randomIdeal

public QuadraticIdeal randomIdeal()