예제 #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);
   }
 }
예제 #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);
 }
예제 #3
0
 public FieldElement negative(FieldElement x) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   return new BigIntegerFieldElement(_x.getValue().negate(), this);
 }
예제 #4
0
 public int compare(FieldElement x, FieldElement y) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   BigIntegerFieldElement _y = validateOtherElement(y);
   return _x.compareTo(_y);
 }
예제 #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);
 }
예제 #6
0
 public FieldElement pow(FieldElement x, BigInteger exp) {
   BigIntegerFieldElement _x = validateOtherElement(x);
   return new BigIntegerFieldElement(_x.getValue().modPow(exp, modulo), this);
 }