P128Pow5T3NativeFp constructor

P128Pow5T3NativeFp({
  1. MdsGenerateResult<PallasNativeFp>? constants,
})

Implementation

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