P128Pow5T3NativeFq constructor

P128Pow5T3NativeFq({
  1. MdsGenerateResult<VestaNativeFq>? constants,
})

Implementation

factory P128Pow5T3NativeFq({MdsGenerateResult<VestaNativeFq>? constants}) {
  if (constants != null && !PoseidonSpec.isValidConstants(constants)) {
    throw ArgumentException.invalidOperationArguments(
      "P128Pow5T3NativeFq",
      reason: "Invalid constants length.",
    );
  }
  constants ??= PoseidonUtils.generateConstants<VestaNativeFq>(
    fromBytes: (bytes) {
      if (bytes.length == 32) {
        return VestaNativeFq.fromBytes(bytes);
      }
      return VestaNativeFq.fromBytes64(bytes);
    },
    zero: VestaNativeFq.zero(),
    one: VestaNativeFq.one(),
  );
  return P128Pow5T3NativeFq._(constants);
}