scalar_add_modulo_2_256 static method

void scalar_add_modulo_2_256(
  1. Uint8List out,
  2. int outOff,
  3. Uint8List op1,
  4. int op1Off,
  5. Uint8List op2,
  6. int op2Off,
)

Implementation

static void scalar_add_modulo_2_256(Uint8List out, int outOff, Uint8List op1,
    int op1Off, Uint8List op2, int op2Off) {
  var carry = 0;
  for (var i = 0; i < 32; i++) {
    var a = op1[i + op1Off];
    var b = op2[i + op2Off];
    var r = a + b + carry;
    out[i + outOff] = r & 0xff;
    carry = (r >= 0x100) ? 1 : 0;
  }
}