poly1305 constructor

poly1305(
  1. Uint8List key
)

Implementation

poly1305(Uint8List key) {
  this._buffer = Uint8List(16);
  this._r = List<Int32>.filled(10, Int32(0));
  this._h = List<Int32>.filled(10, Int32(0));
  this._pad = Int32List(8);
  this._leftover = 0;
  this._fin = 0;

  Int32 t0, t1, t2, t3, t4, t5, t6, t7;

  t0 = Int32(key[0] & 0xff | (key[1] & 0xff) << 8);
  this._r[0] = (t0) & 0x1fff;
  t1 = Int32(key[2] & 0xff | (key[3] & 0xff) << 8);
  this._r[1] = ((t0.shiftRightUnsigned(13)) | (t1 << 3)) & 0x1fff;
  t2 = Int32(key[4] & 0xff | (key[5] & 0xff) << 8);
  this._r[2] = ((t1.shiftRightUnsigned(10)) | (t2 << 6)) & 0x1f03;
  t3 = Int32(key[6] & 0xff | (key[7] & 0xff) << 8);
  this._r[3] = ((t2.shiftRightUnsigned(7)) | (t3 << 9)) & 0x1fff;
  t4 = Int32(key[8] & 0xff | (key[9] & 0xff) << 8);
  this._r[4] = ((t3.shiftRightUnsigned(4)) | (t4 << 12)) & 0x00ff;
  this._r[5] = ((t4.shiftRightUnsigned(1))) & 0x1ffe;
  t5 = Int32(key[10] & 0xff | (key[11] & 0xff) << 8);
  this._r[6] = ((t4.shiftRightUnsigned(14)) | (t5 << 2)) & 0x1fff;
  t6 = Int32(key[12] & 0xff | (key[13] & 0xff) << 8);
  this._r[7] = ((t5.shiftRightUnsigned(11)) | (t6 << 5)) & 0x1f81;
  t7 = Int32(key[14] & 0xff | (key[15] & 0xff) << 8);
  this._r[8] = ((t6.shiftRightUnsigned(8)) | (t7 << 8)) & 0x1fff;
  this._r[9] = ((t7.shiftRightUnsigned(5))) & 0x007f;

  this._pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  this._pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  this._pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  this._pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  this._pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  this._pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  this._pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  this._pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
}