fiatScalarFromBytes function

void fiatScalarFromBytes(
  1. List<BigInt> out1,
  2. List<int> arg1
)

fiatScalarFromBytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order.

Preconditions: 0 ≤ bytes_eval arg1 < m Postconditions: eval out1 mod m = bytes_eval arg1 mod m 0 ≤ eval out1 < m

Input Bounds: arg1: [0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0xff, 0x0 ~> 0x1f] Output Bounds: out1: [0x0 ~> 0xffffffffffffffff, 0x0 ~> 0xffffffffffffffff, 0x0 ~> 0xffffffffffffffff, 0x0 ~> 0x1fffffffffffffff]

Implementation

void fiatScalarFromBytes(List<BigInt> out1, List<int> arg1) {
  final x1 = (arg1[31].toBigInt << 56);
  final x2 = (arg1[30].toBigInt << 48);
  final x3 = (arg1[29].toBigInt << 40);
  final x4 = (arg1[28].toBigInt << 32);
  final x5 = (arg1[27].toBigInt << 24);
  final x6 = (arg1[26].toBigInt << 16);
  final x7 = (arg1[25].toBigInt << 8);
  final x8 = arg1[24];
  final x9 = (arg1[23].toBigInt << 56);
  final x10 = (arg1[22].toBigInt << 48);
  final x11 = (arg1[21].toBigInt << 40);
  final x12 = (arg1[20].toBigInt << 32);
  final x13 = (arg1[19].toBigInt << 24);
  final x14 = (arg1[18].toBigInt << 16);
  final x15 = (arg1[17].toBigInt << 8);
  final x16 = arg1[16];
  final x17 = (arg1[15].toBigInt << 56);
  final x18 = (arg1[14].toBigInt << 48);
  final x19 = (arg1[13].toBigInt << 40);
  final x20 = (arg1[12].toBigInt << 32);
  final x21 = (arg1[11].toBigInt << 24);
  final x22 = (arg1[10].toBigInt << 16);
  final x23 = (arg1[9].toBigInt << 8);
  final x24 = arg1[8];
  final x25 = (arg1[7].toBigInt << 56);
  final x26 = (arg1[6].toBigInt << 48);
  final x27 = (arg1[5].toBigInt << 40);
  final x28 = (arg1[4].toBigInt << 32);
  final x29 = (arg1[3].toBigInt << 24);
  final x30 = (arg1[2].toBigInt << 16);
  final x31 = (arg1[1].toBigInt << 8);
  final x32 = arg1[0];
  final x33 = (x31 + x32.toBigInt);
  final x34 = (x30 + x33);
  final x35 = (x29 + x34);
  final x36 = (x28 + x35);
  final x37 = (x27 + x36);
  final x38 = (x26 + x37);
  final x39 = (x25 + x38);
  final x40 = (x23 + x24.toBigInt);
  final x41 = (x22 + x40);
  final x42 = (x21 + x41);
  final x43 = (x20 + x42);
  final x44 = (x19 + x43);
  final x45 = (x18 + x44);
  final x46 = (x17 + x45);
  final x47 = (x15 + x16.toBigInt);
  final x48 = (x14 + x47);
  final x49 = (x13 + x48);
  final x50 = (x12 + x49);
  final x51 = (x11 + x50);
  final x52 = (x10 + x51);
  final x53 = (x9 + x52);
  final x54 = (x7 + x8.toBigInt);
  final x55 = (x6 + x54);
  final x56 = (x5 + x55);
  final x57 = (x4 + x56);
  final x58 = (x3 + x57);
  final x59 = (x2 + x58);
  final x60 = (x1 + x59);
  out1[0] = x39;
  out1[1] = x46;
  out1[2] = x53;
  out1[3] = x60;
}