Beispiel #1
0
 public FieldElement inverse(FieldElement x) {
   try {
     BigIntegerFieldElement _x = validateOtherElement(x);
     return new BigIntegerFieldElement(_x.getValue().modInverse(modulo), this);
   } catch (ArithmeticException ex) {
     throw new FieldException(ex);
   }
 }
Beispiel #2
0
 public FieldElement multiply(FieldElement x, FieldElement y) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   BigIntegerFieldElement _y = validateOtherElement(y);
   return new BigIntegerFieldElement(_x.getValue().multiply(_y.getValue()), this);
 }
Beispiel #3
0
 public FieldElement negative(FieldElement x) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   return new BigIntegerFieldElement(_x.getValue().negate(), this);
 }
Beispiel #4
0
 public int compare(FieldElement x, FieldElement y) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   BigIntegerFieldElement _y = validateOtherElement(y);
   return _x.compareTo(_y);
 }
Beispiel #5
0
 public FieldElement pow(FieldElement x, long exp) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   BigInteger _exp = BigInteger.valueOf(exp);
   return new BigIntegerFieldElement(_x.getValue().modPow(_exp, modulo), this);
 }
Beispiel #6
0
 public FieldElement pow(FieldElement x, BigInteger exp) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   return new BigIntegerFieldElement(_x.getValue().modPow(exp, modulo), this);
 }