// The CRC catalogue of Greg Cook's reveng (https://reveng.sourceforge.io/
// crc-catalogue/all.htm, as of 2026-11-16): every CRC of at most 64 bits.
// Their check values and residues, which the tests hold each to, are in
// catalogue_wbtest.mbt. CRC-82/DARC, the one wider, is left out.

///|
/// A CRC of the catalogue: its parameters, its name and its aliases.
priv struct Entry {
  name : String
  aliases : Array[String]
  width : Int32
  poly : UInt64
  init : UInt64
  reflect_in : Bool
  reflect_out : Bool
  xor_out : UInt64
}

///|
let catalogue : Array[Entry] = [
  {
    name: "CRC-3/GSM",
    aliases: [],
    width: 3,
    poly: 0x3UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x7UL,
  },
  {
    name: "CRC-3/ROHC",
    aliases: [],
    width: 3,
    poly: 0x3UL,
    init: 0x7UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-4/G-704",
    aliases: ["CRC-4/ITU"],
    width: 4,
    poly: 0x3UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-4/INTERLAKEN",
    aliases: [],
    width: 4,
    poly: 0x3UL,
    init: 0xFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFUL,
  },
  {
    name: "CRC-5/EPC-C1G2",
    aliases: ["CRC-5/EPC"],
    width: 5,
    poly: 0x9UL,
    init: 0x9UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-5/G-704",
    aliases: ["CRC-5/ITU"],
    width: 5,
    poly: 0x15UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-5/USB",
    aliases: [],
    width: 5,
    poly: 0x5UL,
    init: 0x1FUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x1FUL,
  },
  {
    name: "CRC-6/CDMA2000-A",
    aliases: [],
    width: 6,
    poly: 0x27UL,
    init: 0x3FUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-6/CDMA2000-B",
    aliases: [],
    width: 6,
    poly: 0x7UL,
    init: 0x3FUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-6/DARC",
    aliases: [],
    width: 6,
    poly: 0x19UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-6/G-704",
    aliases: ["CRC-6/ITU"],
    width: 6,
    poly: 0x3UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-6/GSM",
    aliases: [],
    width: 6,
    poly: 0x2FUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x3FUL,
  },
  {
    name: "CRC-7/MMC",
    aliases: ["CRC-7"],
    width: 7,
    poly: 0x9UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-7/ROHC",
    aliases: [],
    width: 7,
    poly: 0x4FUL,
    init: 0x7FUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-7/UMTS",
    aliases: [],
    width: 7,
    poly: 0x45UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/AUTOSAR",
    aliases: [],
    width: 8,
    poly: 0x2FUL,
    init: 0xFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFUL,
  },
  {
    name: "CRC-8/BLUETOOTH",
    aliases: [],
    width: 8,
    poly: 0xA7UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/CDMA2000",
    aliases: [],
    width: 8,
    poly: 0x9BUL,
    init: 0xFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/DARC",
    aliases: [],
    width: 8,
    poly: 0x39UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/DVB-S2",
    aliases: [],
    width: 8,
    poly: 0xD5UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/GSM-A",
    aliases: [],
    width: 8,
    poly: 0x1DUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/GSM-B",
    aliases: [],
    width: 8,
    poly: 0x49UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFUL,
  },
  {
    name: "CRC-8/HITAG",
    aliases: [],
    width: 8,
    poly: 0x1DUL,
    init: 0xFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/I-432-1",
    aliases: ["CRC-8/ITU"],
    width: 8,
    poly: 0x7UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x55UL,
  },
  {
    name: "CRC-8/I-CODE",
    aliases: [],
    width: 8,
    poly: 0x1DUL,
    init: 0xFDUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/LTE",
    aliases: [],
    width: 8,
    poly: 0x9BUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/MAXIM-DOW",
    aliases: ["CRC-8/MAXIM", "DOW-CRC"],
    width: 8,
    poly: 0x31UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/MIFARE-MAD",
    aliases: [],
    width: 8,
    poly: 0x1DUL,
    init: 0xC7UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/NRSC-5",
    aliases: [],
    width: 8,
    poly: 0x31UL,
    init: 0xFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/OPENSAFETY",
    aliases: [],
    width: 8,
    poly: 0x2FUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/ROHC",
    aliases: [],
    width: 8,
    poly: 0x7UL,
    init: 0xFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/SAE-J1850",
    aliases: [],
    width: 8,
    poly: 0x1DUL,
    init: 0xFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFUL,
  },
  {
    name: "CRC-8/SMBUS",
    aliases: ["CRC-8"],
    width: 8,
    poly: 0x7UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/TECH-3250",
    aliases: ["CRC-8/AES", "CRC-8/EBU"],
    width: 8,
    poly: 0x1DUL,
    init: 0xFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-8/WCDMA",
    aliases: [],
    width: 8,
    poly: 0x9BUL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-10/ATM",
    aliases: ["CRC-10", "CRC-10/I-610"],
    width: 10,
    poly: 0x233UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-10/CDMA2000",
    aliases: [],
    width: 10,
    poly: 0x3D9UL,
    init: 0x3FFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-10/GSM",
    aliases: [],
    width: 10,
    poly: 0x175UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x3FFUL,
  },
  {
    name: "CRC-11/FLEXRAY",
    aliases: ["CRC-11"],
    width: 11,
    poly: 0x385UL,
    init: 0x1AUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-11/UMTS",
    aliases: [],
    width: 11,
    poly: 0x307UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-12/CDMA2000",
    aliases: [],
    width: 12,
    poly: 0xF13UL,
    init: 0xFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-12/DECT",
    aliases: ["X-CRC-12"],
    width: 12,
    poly: 0x80FUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-12/GSM",
    aliases: [],
    width: 12,
    poly: 0xD31UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFUL,
  },
  {
    name: "CRC-12/UMTS",
    aliases: ["CRC-12/3GPP"],
    width: 12,
    poly: 0x80FUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-13/BBC",
    aliases: [],
    width: 13,
    poly: 0x1CF5UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-14/DARC",
    aliases: [],
    width: 14,
    poly: 0x805UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-14/GSM",
    aliases: [],
    width: 14,
    poly: 0x202DUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x3FFFUL,
  },
  {
    name: "CRC-15/CAN",
    aliases: ["CRC-15"],
    width: 15,
    poly: 0x4599UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-15/MPT1327",
    aliases: [],
    width: 15,
    poly: 0x6815UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x1UL,
  },
  {
    name: "CRC-16/ARC",
    aliases: ["ARC", "CRC-16", "CRC-16/LHA", "CRC-IBM"],
    width: 16,
    poly: 0x8005UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/CDMA2000",
    aliases: [],
    width: 16,
    poly: 0xC867UL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/CMS",
    aliases: [],
    width: 16,
    poly: 0x8005UL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/DDS-110",
    aliases: [],
    width: 16,
    poly: 0x8005UL,
    init: 0x800DUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/DECT-R",
    aliases: ["R-CRC-16"],
    width: 16,
    poly: 0x589UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x1UL,
  },
  {
    name: "CRC-16/DECT-X",
    aliases: ["X-CRC-16"],
    width: 16,
    poly: 0x589UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/DNP",
    aliases: [],
    width: 16,
    poly: 0x3D65UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/EN-13757",
    aliases: [],
    width: 16,
    poly: 0x3D65UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/GENIBUS",
    aliases: ["CRC-16/DARC", "CRC-16/EPC", "CRC-16/EPC-C1G2", "CRC-16/I-CODE"],
    width: 16,
    poly: 0x1021UL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/GSM",
    aliases: [],
    width: 16,
    poly: 0x1021UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/IBM-3740",
    aliases: ["CRC-16/AUTOSAR", "CRC-16/CCITT-FALSE"],
    width: 16,
    poly: 0x1021UL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/IBM-SDLC",
    aliases: [
      "CRC-16/ISO-HDLC", "CRC-16/ISO-IEC-14443-3-B", "CRC-16/X-25", "CRC-B", "X-25",
    ],
    width: 16,
    poly: 0x1021UL,
    init: 0xFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/ISO-IEC-14443-3-A",
    aliases: ["CRC-A"],
    width: 16,
    poly: 0x1021UL,
    init: 0xC6C6UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/KERMIT",
    aliases: [
      "CRC-16/BLUETOOTH", "CRC-16/CCITT", "CRC-16/CCITT-TRUE", "CRC-16/V-41-LSB",
      "CRC-CCITT", "KERMIT",
    ],
    width: 16,
    poly: 0x1021UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/LJ1200",
    aliases: [],
    width: 16,
    poly: 0x6F63UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/M17",
    aliases: [],
    width: 16,
    poly: 0x5935UL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/MAXIM-DOW",
    aliases: ["CRC-16/MAXIM"],
    width: 16,
    poly: 0x8005UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/MCRF4XX",
    aliases: [],
    width: 16,
    poly: 0x1021UL,
    init: 0xFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/MODBUS",
    aliases: ["MODBUS"],
    width: 16,
    poly: 0x8005UL,
    init: 0xFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/NRSC-5",
    aliases: [],
    width: 16,
    poly: 0x80BUL,
    init: 0xFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/OPENSAFETY-A",
    aliases: [],
    width: 16,
    poly: 0x5935UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/OPENSAFETY-B",
    aliases: [],
    width: 16,
    poly: 0x755BUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/PROFIBUS",
    aliases: ["CRC-16/IEC-61158-2"],
    width: 16,
    poly: 0x1DCFUL,
    init: 0xFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/RIELLO",
    aliases: [],
    width: 16,
    poly: 0x1021UL,
    init: 0xB2AAUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/SPI-FUJITSU",
    aliases: ["CRC-16/AUG-CCITT"],
    width: 16,
    poly: 0x1021UL,
    init: 0x1D0FUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/T10-DIF",
    aliases: [],
    width: 16,
    poly: 0x8BB7UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/TELEDISK",
    aliases: [],
    width: 16,
    poly: 0xA097UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/TMS37157",
    aliases: [],
    width: 16,
    poly: 0x1021UL,
    init: 0x89ECUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/UMTS",
    aliases: ["CRC-16/BUYPASS", "CRC-16/VERIFONE"],
    width: 16,
    poly: 0x8005UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-16/USB",
    aliases: [],
    width: 16,
    poly: 0x8005UL,
    init: 0xFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFUL,
  },
  {
    name: "CRC-16/XMODEM",
    aliases: [
      "CRC-16/ACORN", "CRC-16/LTE", "CRC-16/V-41-MSB", "XMODEM", "ZMODEM",
    ],
    width: 16,
    poly: 0x1021UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-17/CAN-FD",
    aliases: [],
    width: 17,
    poly: 0x1685BUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-21/CAN-FD",
    aliases: [],
    width: 21,
    poly: 0x102899UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/BLE",
    aliases: [],
    width: 24,
    poly: 0x65BUL,
    init: 0x555555UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/FLEXRAY-A",
    aliases: [],
    width: 24,
    poly: 0x5D6DCBUL,
    init: 0xFEDCBAUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/FLEXRAY-B",
    aliases: [],
    width: 24,
    poly: 0x5D6DCBUL,
    init: 0xABCDEFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/INTERLAKEN",
    aliases: [],
    width: 24,
    poly: 0x328B63UL,
    init: 0xFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFUL,
  },
  {
    name: "CRC-24/LTE-A",
    aliases: [],
    width: 24,
    poly: 0x864CFBUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/LTE-B",
    aliases: [],
    width: 24,
    poly: 0x800063UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/OPENPGP",
    aliases: ["CRC-24"],
    width: 24,
    poly: 0x864CFBUL,
    init: 0xB704CEUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-24/OS-9",
    aliases: [],
    width: 24,
    poly: 0x800063UL,
    init: 0xFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFUL,
  },
  {
    name: "CRC-30/CDMA",
    aliases: [],
    width: 30,
    poly: 0x2030B9C7UL,
    init: 0x3FFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x3FFFFFFFUL,
  },
  {
    name: "CRC-31/PHILIPS",
    aliases: [],
    width: 31,
    poly: 0x4C11DB7UL,
    init: 0x7FFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x7FFFFFFFUL,
  },
  {
    name: "CRC-32/AIXM",
    aliases: ["CRC-32Q"],
    width: 32,
    poly: 0x814141ABUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-32/AUTOSAR",
    aliases: [],
    width: 32,
    poly: 0xF4ACFB13UL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/BASE91-D",
    aliases: ["CRC-32D"],
    width: 32,
    poly: 0xA833982BUL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/BZIP2",
    aliases: ["CRC-32/AAL5", "CRC-32/DECT-B", "B-CRC-32"],
    width: 32,
    poly: 0x4C11DB7UL,
    init: 0xFFFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/CD-ROM-EDC",
    aliases: [],
    width: 32,
    poly: 0x8001801BUL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-32/CKSUM",
    aliases: ["CKSUM", "CRC-32/POSIX"],
    width: 32,
    poly: 0x4C11DB7UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/ISCSI",
    aliases: [
      "CRC-32/BASE91-C", "CRC-32/CASTAGNOLI", "CRC-32/INTERLAKEN", "CRC-32C", "CRC-32/NVME",
    ],
    width: 32,
    poly: 0x1EDC6F41UL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/ISO-HDLC",
    aliases: ["CRC-32", "CRC-32/ADCCP", "CRC-32/V-42", "CRC-32/XZ", "PKZIP"],
    width: 32,
    poly: 0x4C11DB7UL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFUL,
  },
  {
    name: "CRC-32/JAMCRC",
    aliases: ["JAMCRC"],
    width: 32,
    poly: 0x4C11DB7UL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-32/MEF",
    aliases: [],
    width: 32,
    poly: 0x741B8CD7UL,
    init: 0xFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-32/MPEG-2",
    aliases: [],
    width: 32,
    poly: 0x4C11DB7UL,
    init: 0xFFFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-32/XFER",
    aliases: ["XFER"],
    width: 32,
    poly: 0xAFUL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-40/GSM",
    aliases: [],
    width: 40,
    poly: 0x4820009UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFFFFFUL,
  },
  {
    name: "CRC-64/ECMA-182",
    aliases: ["CRC-64"],
    width: 64,
    poly: 0x42F0E1EBA9EA3693UL,
    init: 0x0UL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-64/GO-ISO",
    aliases: [],
    width: 64,
    poly: 0x1BUL,
    init: 0xFFFFFFFFFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFFFFFFFFFUL,
  },
  {
    name: "CRC-64/MS",
    aliases: [],
    width: 64,
    poly: 0x259C84CBA6426349UL,
    init: 0xFFFFFFFFFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-64/NVME",
    aliases: [],
    width: 64,
    poly: 0xAD93D23594C93659UL,
    init: 0xFFFFFFFFFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFFFFFFFFFUL,
  },
  {
    name: "CRC-64/REDIS",
    aliases: [],
    width: 64,
    poly: 0xAD93D23594C935A9UL,
    init: 0x0UL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0x0UL,
  },
  {
    name: "CRC-64/WE",
    aliases: [],
    width: 64,
    poly: 0x42F0E1EBA9EA3693UL,
    init: 0xFFFFFFFFFFFFFFFFUL,
    reflect_in: false,
    reflect_out: false,
    xor_out: 0xFFFFFFFFFFFFFFFFUL,
  },
  {
    name: "CRC-64/XZ",
    aliases: ["CRC-64/GO-ECMA"],
    width: 64,
    poly: 0x42F0E1EBA9EA3693UL,
    init: 0xFFFFFFFFFFFFFFFFUL,
    reflect_in: true,
    reflect_out: true,
    xor_out: 0xFFFFFFFFFFFFFFFFUL,
  },
]

///|
/// The CRC the reveng catalogue calls `name`, by its name or an alias, in
/// any case: "CRC-32" (an alias of CRC-32/ISO-HDLC), "CRC-16/ARC",
/// "CRC-64/XZ" and so on; None for a name it does not have.
pub fn Crc::named(name : String) -> Crc? {
  let wanted = name.to_upper()
  for e in catalogue {
    if e.name == wanted || e.aliases.contains(wanted) {
      return Some(
        Crc::new(
          width=e.width,
          poly=e.poly,
          init=e.init,
          reflect_in=e.reflect_in,
          reflect_out=e.reflect_out,
          xor_out=e.xor_out,
        ),
      )
    }
  }
  None
}