PallasNativeFp.fromBytes constructor

PallasNativeFp.fromBytes(
  1. List<int> bytes
)

Implementation

factory PallasNativeFp.fromBytes(List<int> bytes) {
  final toBig = BigintUtils.fromBytes(
    bytes.exc(
      length: 32,
      operation: "fromBytes",
      reason: "Invalid field bytes length.",
    ),
    byteOrder: Endian.little,
  );
  if (toBig >= PastaNativeConst.q) {
    throw ArgumentException.invalidOperationArguments(
      "fromBytes",
      reason: "Invalid field bytes encoding.",
    );
  }
  return PallasNativeFp(toBig);
}