lookupPoly static method

Uint8List lookupPoly(
  1. int blockSizeLength
)

Implementation

static Uint8List lookupPoly(int blockSizeLength) {
  int xor;
  switch (blockSizeLength * 8) {
    case 64:
      xor = 0x1B;
      break;
    case 128:
      xor = 0x87;
      break;
    case 160:
      xor = 0x2D;
      break;
    case 192:
      xor = 0x87;
      break;
    case 224:
      xor = 0x309;
      break;
    case 256:
      xor = 0x425;
      break;
    case 320:
      xor = 0x1B;
      break;
    case 384:
      xor = 0x100D;
      break;
    case 448:
      xor = 0x851;
      break;
    case 512:
      xor = 0x125;
      break;
    case 768:
      xor = 0xA0011;
      break;
    case 1024:
      xor = 0x80043;
      break;
    case 2048:
      xor = 0x86001;
      break;
    default:
      throw ArgumentError(
          'Unknown block size for CMAC: ${blockSizeLength * 8}');
  }

  final out = Uint8List(4);
  out[3] = xor >> 0;
  out[2] = xor >> 8;
  out[1] = xor >> 16;
  out[0] = xor >> 24;
  return out;
}