JubJubNativeFq.fromBytes constructor

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

Implementation

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