Esempio n. 1
0
 public HEC3n toHessian() {
   if (this.isSupersingular() && !this.a.equals(this.a.getFiniteField().one()))
     throw new InvalidParameterException(
         "Elliptic curve must be ordinary and the quadratic coefficient must be 1.");
   try {
     GF3nElement x = a.invert().multiply(b);
     GF3nElement newC = x.cube().sum(x.multiply(b).negate()).sum(c);
     int n = this.a.getFiniteField().getExtensionDegree();
     for (int i = 1; i < n; i++) newC = newC.cube();
     newC = newC.invert().negate();
     return new HEC3n(newC);
   } catch (NoCommonFiniteFieldException | NotInFiniteFieldException e) {
     // This shouldn't happen never
     e.printStackTrace();
     return null;
   }
 }
Esempio n. 2
0
 @Override
 public boolean isSingular() {
   if (a.isZero() && b.isZero()) return false;
   else if (!(a.isZero() || b.isZero())) {
     try {
       GF3nElement x = a.invert().multiply(b);
       if (x.cube().sum(x.multiply(b).negate()).sum(c).isZero()) return false;
       else return true;
     } catch (NoCommonFiniteFieldException | NotInFiniteFieldException e) {
       // This shouldn't happen never
       e.printStackTrace();
       return false;
     }
   } else return true;
 }