cyclotomicExp static method

Bls12NativeFp12 cyclotomicExp(
  1. Bls12NativeFp12 f
)

Implementation

static Bls12NativeFp12 cyclotomicExp(Bls12NativeFp12 f) {
  var tmp = Bls12NativeFp12.one();
  bool foundOne = false;
  final blsX = Bls12PairingUtils.blsX;
  for (int b = 63; b >= 0; b--) {
    bool bit = ((blsX >> b) & BigInt.one) == BigInt.one;
    if (foundOne) {
      tmp = cyclotomicSquare(tmp);
    } else {
      foundOne = bit;
    }

    if (bit) {
      tmp *= f;
    }
  }

  return tmp.conjugate();
}