Commit 271d896446

Brandon Black <bblack@wikimedia.org>
2024-04-06 17:27:59
std.hash.crc: get rid of usingnamespace
This flips things around such that std/hash/crc.zig is generated by the catalog-based generation tool, and the real code that used to be in that file is moved out to std/hash/crc/impl.zig. The generated tests are moved to std/hash/crc/test.zig. By going this route, we eliminate the need for usingnamespace without changing anything for callers of these interfaces. The Crc32 tests are simply added to the fixed part of the generated output and compactified a bit. This was the second-to-last usage of usingnamespace left in std.
1 parent 786876c
Changed files (5)
lib/std/hash/crc/catalog.zig
@@ -1,903 +0,0 @@
-//! This file is auto-generated by tools/update_crc_catalog.zig.
-
-const Crc = @import("../crc.zig").Crc;
-
-test {
-    _ = @import("catalog_test.zig");
-}
-
-pub const Crc3Gsm = Crc(u3, .{
-    .polynomial = 0x3,
-    .initial = 0x0,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x7,
-});
-
-pub const Crc3Rohc = Crc(u3, .{
-    .polynomial = 0x3,
-    .initial = 0x7,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0,
-});
-
-pub const Crc4G704 = Crc(u4, .{
-    .polynomial = 0x3,
-    .initial = 0x0,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0,
-});
-
-pub const Crc4Interlaken = Crc(u4, .{
-    .polynomial = 0x3,
-    .initial = 0xf,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xf,
-});
-
-pub const Crc5EpcC1g2 = Crc(u5, .{
-    .polynomial = 0x09,
-    .initial = 0x09,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc5G704 = Crc(u5, .{
-    .polynomial = 0x15,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc5Usb = Crc(u5, .{
-    .polynomial = 0x05,
-    .initial = 0x1f,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x1f,
-});
-
-pub const Crc6Cdma2000A = Crc(u6, .{
-    .polynomial = 0x27,
-    .initial = 0x3f,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc6Cdma2000B = Crc(u6, .{
-    .polynomial = 0x07,
-    .initial = 0x3f,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc6Darc = Crc(u6, .{
-    .polynomial = 0x19,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc6G704 = Crc(u6, .{
-    .polynomial = 0x03,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc6Gsm = Crc(u6, .{
-    .polynomial = 0x2f,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x3f,
-});
-
-pub const Crc7Mmc = Crc(u7, .{
-    .polynomial = 0x09,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc7Rohc = Crc(u7, .{
-    .polynomial = 0x4f,
-    .initial = 0x7f,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc7Umts = Crc(u7, .{
-    .polynomial = 0x45,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Autosar = Crc(u8, .{
-    .polynomial = 0x2f,
-    .initial = 0xff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xff,
-});
-
-pub const Crc8Bluetooth = Crc(u8, .{
-    .polynomial = 0xa7,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Cdma2000 = Crc(u8, .{
-    .polynomial = 0x9b,
-    .initial = 0xff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Darc = Crc(u8, .{
-    .polynomial = 0x39,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc8DvbS2 = Crc(u8, .{
-    .polynomial = 0xd5,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8GsmA = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8GsmB = Crc(u8, .{
-    .polynomial = 0x49,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xff,
-});
-
-pub const Crc8Hitag = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0xff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8I4321 = Crc(u8, .{
-    .polynomial = 0x07,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x55,
-});
-
-pub const Crc8ICode = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0xfd,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Lte = Crc(u8, .{
-    .polynomial = 0x9b,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8MaximDow = Crc(u8, .{
-    .polynomial = 0x31,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc8MifareMad = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0xc7,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Nrsc5 = Crc(u8, .{
-    .polynomial = 0x31,
-    .initial = 0xff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Opensafety = Crc(u8, .{
-    .polynomial = 0x2f,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Rohc = Crc(u8, .{
-    .polynomial = 0x07,
-    .initial = 0xff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc8SaeJ1850 = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0xff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xff,
-});
-
-pub const Crc8Smbus = Crc(u8, .{
-    .polynomial = 0x07,
-    .initial = 0x00,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Tech3250 = Crc(u8, .{
-    .polynomial = 0x1d,
-    .initial = 0xff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc8Wcdma = Crc(u8, .{
-    .polynomial = 0x9b,
-    .initial = 0x00,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00,
-});
-
-pub const Crc10Atm = Crc(u10, .{
-    .polynomial = 0x233,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc10Cdma2000 = Crc(u10, .{
-    .polynomial = 0x3d9,
-    .initial = 0x3ff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc10Gsm = Crc(u10, .{
-    .polynomial = 0x175,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x3ff,
-});
-
-pub const Crc11Flexray = Crc(u11, .{
-    .polynomial = 0x385,
-    .initial = 0x01a,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc11Umts = Crc(u11, .{
-    .polynomial = 0x307,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc12Cdma2000 = Crc(u12, .{
-    .polynomial = 0xf13,
-    .initial = 0xfff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc12Dect = Crc(u12, .{
-    .polynomial = 0x80f,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000,
-});
-
-pub const Crc12Gsm = Crc(u12, .{
-    .polynomial = 0xd31,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xfff,
-});
-
-pub const Crc12Umts = Crc(u12, .{
-    .polynomial = 0x80f,
-    .initial = 0x000,
-    .reflect_input = false,
-    .reflect_output = true,
-    .xor_output = 0x000,
-});
-
-pub const Crc13Bbc = Crc(u13, .{
-    .polynomial = 0x1cf5,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc14Darc = Crc(u14, .{
-    .polynomial = 0x0805,
-    .initial = 0x0000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc14Gsm = Crc(u14, .{
-    .polynomial = 0x202d,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x3fff,
-});
-
-pub const Crc15Can = Crc(u15, .{
-    .polynomial = 0x4599,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc15Mpt1327 = Crc(u15, .{
-    .polynomial = 0x6815,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0001,
-});
-
-pub const Crc16Arc = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0x0000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Cdma2000 = Crc(u16, .{
-    .polynomial = 0xc867,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Cms = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Dds110 = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0x800d,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16DectR = Crc(u16, .{
-    .polynomial = 0x0589,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0001,
-});
-
-pub const Crc16DectX = Crc(u16, .{
-    .polynomial = 0x0589,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Dnp = Crc(u16, .{
-    .polynomial = 0x3d65,
-    .initial = 0x0000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16En13757 = Crc(u16, .{
-    .polynomial = 0x3d65,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Genibus = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Gsm = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Ibm3740 = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16IbmSdlc = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16IsoIec144433A = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xc6c6,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Kermit = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0x0000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Lj1200 = Crc(u16, .{
-    .polynomial = 0x6f63,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16M17 = Crc(u16, .{
-    .polynomial = 0x5935,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16MaximDow = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0x0000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Mcrf4xx = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Modbus = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0xffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Nrsc5 = Crc(u16, .{
-    .polynomial = 0x080b,
-    .initial = 0xffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16OpensafetyA = Crc(u16, .{
-    .polynomial = 0x5935,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16OpensafetyB = Crc(u16, .{
-    .polynomial = 0x755b,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Profibus = Crc(u16, .{
-    .polynomial = 0x1dcf,
-    .initial = 0xffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Riello = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0xb2aa,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16SpiFujitsu = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0x1d0f,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16T10Dif = Crc(u16, .{
-    .polynomial = 0x8bb7,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Teledisk = Crc(u16, .{
-    .polynomial = 0xa097,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Tms37157 = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0x89ec,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Umts = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc16Usb = Crc(u16, .{
-    .polynomial = 0x8005,
-    .initial = 0xffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffff,
-});
-
-pub const Crc16Xmodem = Crc(u16, .{
-    .polynomial = 0x1021,
-    .initial = 0x0000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000,
-});
-
-pub const Crc17CanFd = Crc(u17, .{
-    .polynomial = 0x1685b,
-    .initial = 0x00000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00000,
-});
-
-pub const Crc21CanFd = Crc(u21, .{
-    .polynomial = 0x102899,
-    .initial = 0x000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24Ble = Crc(u24, .{
-    .polynomial = 0x00065b,
-    .initial = 0x555555,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24FlexrayA = Crc(u24, .{
-    .polynomial = 0x5d6dcb,
-    .initial = 0xfedcba,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24FlexrayB = Crc(u24, .{
-    .polynomial = 0x5d6dcb,
-    .initial = 0xabcdef,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24Interlaken = Crc(u24, .{
-    .polynomial = 0x328b63,
-    .initial = 0xffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffff,
-});
-
-pub const Crc24LteA = Crc(u24, .{
-    .polynomial = 0x864cfb,
-    .initial = 0x000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24LteB = Crc(u24, .{
-    .polynomial = 0x800063,
-    .initial = 0x000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24Openpgp = Crc(u24, .{
-    .polynomial = 0x864cfb,
-    .initial = 0xb704ce,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x000000,
-});
-
-pub const Crc24Os9 = Crc(u24, .{
-    .polynomial = 0x800063,
-    .initial = 0xffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffff,
-});
-
-pub const Crc30Cdma = Crc(u30, .{
-    .polynomial = 0x2030b9c7,
-    .initial = 0x3fffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x3fffffff,
-});
-
-pub const Crc31Philips = Crc(u31, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0x7fffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x7fffffff,
-});
-
-pub const Crc32Aixm = Crc(u32, .{
-    .polynomial = 0x814141ab,
-    .initial = 0x00000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc32Autosar = Crc(u32, .{
-    .polynomial = 0xf4acfb13,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32Base91D = Crc(u32, .{
-    .polynomial = 0xa833982b,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32Bzip2 = Crc(u32, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0xffffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32CdRomEdc = Crc(u32, .{
-    .polynomial = 0x8001801b,
-    .initial = 0x00000000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc32Cksum = Crc(u32, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0x00000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32Iscsi = Crc(u32, .{
-    .polynomial = 0x1edc6f41,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32IsoHdlc = Crc(u32, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffff,
-});
-
-pub const Crc32Jamcrc = Crc(u32, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc32Mef = Crc(u32, .{
-    .polynomial = 0x741b8cd7,
-    .initial = 0xffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc32Mpeg2 = Crc(u32, .{
-    .polynomial = 0x04c11db7,
-    .initial = 0xffffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc32Xfer = Crc(u32, .{
-    .polynomial = 0x000000af,
-    .initial = 0x00000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x00000000,
-});
-
-pub const Crc40Gsm = Crc(u40, .{
-    .polynomial = 0x0004820009,
-    .initial = 0x0000000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffffffff,
-});
-
-pub const Crc64Ecma182 = Crc(u64, .{
-    .polynomial = 0x42f0e1eba9ea3693,
-    .initial = 0x0000000000000000,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0x0000000000000000,
-});
-
-pub const Crc64GoIso = Crc(u64, .{
-    .polynomial = 0x000000000000001b,
-    .initial = 0xffffffffffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffffffffffff,
-});
-
-pub const Crc64Ms = Crc(u64, .{
-    .polynomial = 0x259c84cba6426349,
-    .initial = 0xffffffffffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000000000000000,
-});
-
-pub const Crc64Redis = Crc(u64, .{
-    .polynomial = 0xad93d23594c935a9,
-    .initial = 0x0000000000000000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x0000000000000000,
-});
-
-pub const Crc64We = Crc(u64, .{
-    .polynomial = 0x42f0e1eba9ea3693,
-    .initial = 0xffffffffffffffff,
-    .reflect_input = false,
-    .reflect_output = false,
-    .xor_output = 0xffffffffffffffff,
-});
-
-pub const Crc64Xz = Crc(u64, .{
-    .polynomial = 0x42f0e1eba9ea3693,
-    .initial = 0xffffffffffffffff,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0xffffffffffffffff,
-});
-
-pub const Crc82Darc = Crc(u82, .{
-    .polynomial = 0x0308c0111011401440411,
-    .initial = 0x000000000000000000000,
-    .reflect_input = true,
-    .reflect_output = true,
-    .xor_output = 0x000000000000000000000,
-});
lib/std/hash/crc/impl.zig
@@ -0,0 +1,241 @@
+// There is a generic CRC implementation "Crc()" which can be paramterized via
+// the Algorithm struct for a plethora of uses, along with two implementations
+// of CRC32 implemented with the following key characteristics:
+//
+// - Crc32WithPoly uses 8Kb of tables but is ~10x faster than the small method.
+//
+// - Crc32SmallWithPoly uses only 64 bytes of memory but is slower. Be aware that this is
+//   still moderately fast just slow relative to the slicing approach.
+//
+// The primary interface for all of the standard CRC algorithms is the
+// generated file "crc.zig", which uses the implementation code here to define
+// many standard CRCs.
+
+const std = @import("std");
+
+pub fn Algorithm(comptime W: type) type {
+    return struct {
+        polynomial: W,
+        initial: W,
+        reflect_input: bool,
+        reflect_output: bool,
+        xor_output: W,
+    };
+}
+
+pub fn Crc(comptime W: type, comptime algorithm: Algorithm(W)) type {
+    return struct {
+        const Self = @This();
+        const I = if (@bitSizeOf(W) < 8) u8 else W;
+        const lookup_table = blk: {
+            @setEvalBranchQuota(2500);
+
+            const poly = if (algorithm.reflect_input)
+                @bitReverse(@as(I, algorithm.polynomial)) >> (@bitSizeOf(I) - @bitSizeOf(W))
+            else
+                @as(I, algorithm.polynomial) << (@bitSizeOf(I) - @bitSizeOf(W));
+
+            var table: [256]I = undefined;
+            for (&table, 0..) |*e, i| {
+                var crc: I = i;
+                if (algorithm.reflect_input) {
+                    var j: usize = 0;
+                    while (j < 8) : (j += 1) {
+                        crc = (crc >> 1) ^ ((crc & 1) * poly);
+                    }
+                } else {
+                    crc <<= @bitSizeOf(I) - 8;
+                    var j: usize = 0;
+                    while (j < 8) : (j += 1) {
+                        crc = (crc << 1) ^ (((crc >> (@bitSizeOf(I) - 1)) & 1) * poly);
+                    }
+                }
+                e.* = crc;
+            }
+            break :blk table;
+        };
+
+        crc: I,
+
+        pub fn init() Self {
+            const initial = if (algorithm.reflect_input)
+                @bitReverse(@as(I, algorithm.initial)) >> (@bitSizeOf(I) - @bitSizeOf(W))
+            else
+                @as(I, algorithm.initial) << (@bitSizeOf(I) - @bitSizeOf(W));
+            return Self{ .crc = initial };
+        }
+
+        inline fn tableEntry(index: I) I {
+            return lookup_table[@as(u8, @intCast(index & 0xFF))];
+        }
+
+        pub fn update(self: *Self, bytes: []const u8) void {
+            var i: usize = 0;
+            if (@bitSizeOf(I) <= 8) {
+                while (i < bytes.len) : (i += 1) {
+                    self.crc = tableEntry(self.crc ^ bytes[i]);
+                }
+            } else if (algorithm.reflect_input) {
+                while (i < bytes.len) : (i += 1) {
+                    const table_index = self.crc ^ bytes[i];
+                    self.crc = tableEntry(table_index) ^ (self.crc >> 8);
+                }
+            } else {
+                while (i < bytes.len) : (i += 1) {
+                    const table_index = (self.crc >> (@bitSizeOf(I) - 8)) ^ bytes[i];
+                    self.crc = tableEntry(table_index) ^ (self.crc << 8);
+                }
+            }
+        }
+
+        pub fn final(self: Self) W {
+            var c = self.crc;
+            if (algorithm.reflect_input != algorithm.reflect_output) {
+                c = @bitReverse(c);
+            }
+            if (!algorithm.reflect_output) {
+                c >>= @bitSizeOf(I) - @bitSizeOf(W);
+            }
+            return @as(W, @intCast(c ^ algorithm.xor_output));
+        }
+
+        pub fn hash(bytes: []const u8) W {
+            var c = Self.init();
+            c.update(bytes);
+            return c.final();
+        }
+    };
+}
+
+pub const Polynomial = enum(u32) {
+    IEEE = 0xedb88320,
+    Castagnoli = 0x82f63b78,
+    Koopman = 0xeb31d82e,
+    _,
+};
+
+// slicing-by-8 crc32 implementation.
+pub fn Crc32WithPoly(comptime poly: Polynomial) type {
+    return struct {
+        const Self = @This();
+        const lookup_tables = block: {
+            @setEvalBranchQuota(20000);
+            var tables: [8][256]u32 = undefined;
+
+            for (&tables[0], 0..) |*e, i| {
+                var crc = @as(u32, @intCast(i));
+                var j: usize = 0;
+                while (j < 8) : (j += 1) {
+                    if (crc & 1 == 1) {
+                        crc = (crc >> 1) ^ @intFromEnum(poly);
+                    } else {
+                        crc = (crc >> 1);
+                    }
+                }
+                e.* = crc;
+            }
+
+            var i: usize = 0;
+            while (i < 256) : (i += 1) {
+                var crc = tables[0][i];
+                var j: usize = 1;
+                while (j < 8) : (j += 1) {
+                    const index: u8 = @truncate(crc);
+                    crc = tables[0][index] ^ (crc >> 8);
+                    tables[j][i] = crc;
+                }
+            }
+
+            break :block tables;
+        };
+
+        crc: u32,
+
+        pub fn init() Self {
+            return Self{ .crc = 0xffffffff };
+        }
+
+        pub fn update(self: *Self, input: []const u8) void {
+            var i: usize = 0;
+            while (i + 8 <= input.len) : (i += 8) {
+                const p = input[i..][0..8];
+
+                // Unrolling this way gives ~50Mb/s increase
+                self.crc ^= std.mem.readInt(u32, p[0..4], .little);
+
+                self.crc =
+                    lookup_tables[0][p[7]] ^
+                    lookup_tables[1][p[6]] ^
+                    lookup_tables[2][p[5]] ^
+                    lookup_tables[3][p[4]] ^
+                    lookup_tables[4][@as(u8, @truncate(self.crc >> 24))] ^
+                    lookup_tables[5][@as(u8, @truncate(self.crc >> 16))] ^
+                    lookup_tables[6][@as(u8, @truncate(self.crc >> 8))] ^
+                    lookup_tables[7][@as(u8, @truncate(self.crc >> 0))];
+            }
+
+            while (i < input.len) : (i += 1) {
+                const index = @as(u8, @truncate(self.crc)) ^ input[i];
+                self.crc = (self.crc >> 8) ^ lookup_tables[0][index];
+            }
+        }
+
+        pub fn final(self: *Self) u32 {
+            return ~self.crc;
+        }
+
+        pub fn hash(input: []const u8) u32 {
+            var c = Self.init();
+            c.update(input);
+            return c.final();
+        }
+    };
+}
+
+// half-byte lookup table implementation.
+pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type {
+    return struct {
+        const Self = @This();
+        const lookup_table = block: {
+            var table: [16]u32 = undefined;
+
+            for (&table, 0..) |*e, i| {
+                var crc = @as(u32, @intCast(i * 16));
+                var j: usize = 0;
+                while (j < 8) : (j += 1) {
+                    if (crc & 1 == 1) {
+                        crc = (crc >> 1) ^ @intFromEnum(poly);
+                    } else {
+                        crc = (crc >> 1);
+                    }
+                }
+                e.* = crc;
+            }
+
+            break :block table;
+        };
+
+        crc: u32,
+
+        pub fn init() Self {
+            return Self{ .crc = 0xffffffff };
+        }
+
+        pub fn update(self: *Self, input: []const u8) void {
+            for (input) |b| {
+                self.crc = lookup_table[@as(u4, @truncate(self.crc ^ (b >> 0)))] ^ (self.crc >> 4);
+                self.crc = lookup_table[@as(u4, @truncate(self.crc ^ (b >> 4)))] ^ (self.crc >> 4);
+            }
+        }
+
+        pub fn final(self: *Self) u32 {
+            return ~self.crc;
+        }
+
+        pub fn hash(input: []const u8) u32 {
+            var c = Self.init();
+            c.update(input);
+            return c.final();
+        }
+    };
+}
lib/std/hash/crc/catalog_test.zig โ†’ lib/std/hash/crc/test.zig
@@ -2,10 +2,29 @@
 
 const std = @import("std");
 const testing = std.testing;
-const catalog = @import("catalog.zig");
+const verify = @import("../verify.zig");
+const crc = @import("../crc.zig");
+
+test "crc32 ieee" {
+    inline for ([2]type{ crc.Crc32WithPoly(.IEEE), crc.Crc32SmallWithPoly(.IEEE) }) |ieee| {
+        try testing.expect(ieee.hash("") == 0x00000000);
+        try testing.expect(ieee.hash("a") == 0xe8b7be43);
+        try testing.expect(ieee.hash("abc") == 0x352441c2);
+        try verify.iterativeApi(ieee);
+    }
+}
+
+test "crc32 castagnoli" {
+    inline for ([2]type{ crc.Crc32WithPoly(.Castagnoli), crc.Crc32SmallWithPoly(.Castagnoli) }) |casta| {
+        try testing.expect(casta.hash("") == 0x00000000);
+        try testing.expect(casta.hash("a") == 0xc1d04330);
+        try testing.expect(casta.hash("abc") == 0x364b3fb7);
+        try verify.iterativeApi(casta);
+    }
+}
 
 test "CRC-3/GSM" {
-    const Crc3Gsm = catalog.Crc3Gsm;
+    const Crc3Gsm = crc.Crc3Gsm;
 
     try testing.expectEqual(@as(u3, 0x4), Crc3Gsm.hash("123456789"));
 
@@ -16,7 +35,7 @@ test "CRC-3/GSM" {
 }
 
 test "CRC-3/ROHC" {
-    const Crc3Rohc = catalog.Crc3Rohc;
+    const Crc3Rohc = crc.Crc3Rohc;
 
     try testing.expectEqual(@as(u3, 0x6), Crc3Rohc.hash("123456789"));
 
@@ -27,7 +46,7 @@ test "CRC-3/ROHC" {
 }
 
 test "CRC-4/G-704" {
-    const Crc4G704 = catalog.Crc4G704;
+    const Crc4G704 = crc.Crc4G704;
 
     try testing.expectEqual(@as(u4, 0x7), Crc4G704.hash("123456789"));
 
@@ -38,7 +57,7 @@ test "CRC-4/G-704" {
 }
 
 test "CRC-4/INTERLAKEN" {
-    const Crc4Interlaken = catalog.Crc4Interlaken;
+    const Crc4Interlaken = crc.Crc4Interlaken;
 
     try testing.expectEqual(@as(u4, 0xb), Crc4Interlaken.hash("123456789"));
 
@@ -49,7 +68,7 @@ test "CRC-4/INTERLAKEN" {
 }
 
 test "CRC-5/EPC-C1G2" {
-    const Crc5EpcC1g2 = catalog.Crc5EpcC1g2;
+    const Crc5EpcC1g2 = crc.Crc5EpcC1g2;
 
     try testing.expectEqual(@as(u5, 0x00), Crc5EpcC1g2.hash("123456789"));
 
@@ -60,7 +79,7 @@ test "CRC-5/EPC-C1G2" {
 }
 
 test "CRC-5/G-704" {
-    const Crc5G704 = catalog.Crc5G704;
+    const Crc5G704 = crc.Crc5G704;
 
     try testing.expectEqual(@as(u5, 0x07), Crc5G704.hash("123456789"));
 
@@ -71,7 +90,7 @@ test "CRC-5/G-704" {
 }
 
 test "CRC-5/USB" {
-    const Crc5Usb = catalog.Crc5Usb;
+    const Crc5Usb = crc.Crc5Usb;
 
     try testing.expectEqual(@as(u5, 0x19), Crc5Usb.hash("123456789"));
 
@@ -82,7 +101,7 @@ test "CRC-5/USB" {
 }
 
 test "CRC-6/CDMA2000-A" {
-    const Crc6Cdma2000A = catalog.Crc6Cdma2000A;
+    const Crc6Cdma2000A = crc.Crc6Cdma2000A;
 
     try testing.expectEqual(@as(u6, 0x0d), Crc6Cdma2000A.hash("123456789"));
 
@@ -93,7 +112,7 @@ test "CRC-6/CDMA2000-A" {
 }
 
 test "CRC-6/CDMA2000-B" {
-    const Crc6Cdma2000B = catalog.Crc6Cdma2000B;
+    const Crc6Cdma2000B = crc.Crc6Cdma2000B;
 
     try testing.expectEqual(@as(u6, 0x3b), Crc6Cdma2000B.hash("123456789"));
 
@@ -104,7 +123,7 @@ test "CRC-6/CDMA2000-B" {
 }
 
 test "CRC-6/DARC" {
-    const Crc6Darc = catalog.Crc6Darc;
+    const Crc6Darc = crc.Crc6Darc;
 
     try testing.expectEqual(@as(u6, 0x26), Crc6Darc.hash("123456789"));
 
@@ -115,7 +134,7 @@ test "CRC-6/DARC" {
 }
 
 test "CRC-6/G-704" {
-    const Crc6G704 = catalog.Crc6G704;
+    const Crc6G704 = crc.Crc6G704;
 
     try testing.expectEqual(@as(u6, 0x06), Crc6G704.hash("123456789"));
 
@@ -126,7 +145,7 @@ test "CRC-6/G-704" {
 }
 
 test "CRC-6/GSM" {
-    const Crc6Gsm = catalog.Crc6Gsm;
+    const Crc6Gsm = crc.Crc6Gsm;
 
     try testing.expectEqual(@as(u6, 0x13), Crc6Gsm.hash("123456789"));
 
@@ -137,7 +156,7 @@ test "CRC-6/GSM" {
 }
 
 test "CRC-7/MMC" {
-    const Crc7Mmc = catalog.Crc7Mmc;
+    const Crc7Mmc = crc.Crc7Mmc;
 
     try testing.expectEqual(@as(u7, 0x75), Crc7Mmc.hash("123456789"));
 
@@ -148,7 +167,7 @@ test "CRC-7/MMC" {
 }
 
 test "CRC-7/ROHC" {
-    const Crc7Rohc = catalog.Crc7Rohc;
+    const Crc7Rohc = crc.Crc7Rohc;
 
     try testing.expectEqual(@as(u7, 0x53), Crc7Rohc.hash("123456789"));
 
@@ -159,7 +178,7 @@ test "CRC-7/ROHC" {
 }
 
 test "CRC-7/UMTS" {
-    const Crc7Umts = catalog.Crc7Umts;
+    const Crc7Umts = crc.Crc7Umts;
 
     try testing.expectEqual(@as(u7, 0x61), Crc7Umts.hash("123456789"));
 
@@ -170,7 +189,7 @@ test "CRC-7/UMTS" {
 }
 
 test "CRC-8/AUTOSAR" {
-    const Crc8Autosar = catalog.Crc8Autosar;
+    const Crc8Autosar = crc.Crc8Autosar;
 
     try testing.expectEqual(@as(u8, 0xdf), Crc8Autosar.hash("123456789"));
 
@@ -181,7 +200,7 @@ test "CRC-8/AUTOSAR" {
 }
 
 test "CRC-8/BLUETOOTH" {
-    const Crc8Bluetooth = catalog.Crc8Bluetooth;
+    const Crc8Bluetooth = crc.Crc8Bluetooth;
 
     try testing.expectEqual(@as(u8, 0x26), Crc8Bluetooth.hash("123456789"));
 
@@ -192,7 +211,7 @@ test "CRC-8/BLUETOOTH" {
 }
 
 test "CRC-8/CDMA2000" {
-    const Crc8Cdma2000 = catalog.Crc8Cdma2000;
+    const Crc8Cdma2000 = crc.Crc8Cdma2000;
 
     try testing.expectEqual(@as(u8, 0xda), Crc8Cdma2000.hash("123456789"));
 
@@ -203,7 +222,7 @@ test "CRC-8/CDMA2000" {
 }
 
 test "CRC-8/DARC" {
-    const Crc8Darc = catalog.Crc8Darc;
+    const Crc8Darc = crc.Crc8Darc;
 
     try testing.expectEqual(@as(u8, 0x15), Crc8Darc.hash("123456789"));
 
@@ -214,7 +233,7 @@ test "CRC-8/DARC" {
 }
 
 test "CRC-8/DVB-S2" {
-    const Crc8DvbS2 = catalog.Crc8DvbS2;
+    const Crc8DvbS2 = crc.Crc8DvbS2;
 
     try testing.expectEqual(@as(u8, 0xbc), Crc8DvbS2.hash("123456789"));
 
@@ -225,7 +244,7 @@ test "CRC-8/DVB-S2" {
 }
 
 test "CRC-8/GSM-A" {
-    const Crc8GsmA = catalog.Crc8GsmA;
+    const Crc8GsmA = crc.Crc8GsmA;
 
     try testing.expectEqual(@as(u8, 0x37), Crc8GsmA.hash("123456789"));
 
@@ -236,7 +255,7 @@ test "CRC-8/GSM-A" {
 }
 
 test "CRC-8/GSM-B" {
-    const Crc8GsmB = catalog.Crc8GsmB;
+    const Crc8GsmB = crc.Crc8GsmB;
 
     try testing.expectEqual(@as(u8, 0x94), Crc8GsmB.hash("123456789"));
 
@@ -247,7 +266,7 @@ test "CRC-8/GSM-B" {
 }
 
 test "CRC-8/HITAG" {
-    const Crc8Hitag = catalog.Crc8Hitag;
+    const Crc8Hitag = crc.Crc8Hitag;
 
     try testing.expectEqual(@as(u8, 0xb4), Crc8Hitag.hash("123456789"));
 
@@ -258,7 +277,7 @@ test "CRC-8/HITAG" {
 }
 
 test "CRC-8/I-432-1" {
-    const Crc8I4321 = catalog.Crc8I4321;
+    const Crc8I4321 = crc.Crc8I4321;
 
     try testing.expectEqual(@as(u8, 0xa1), Crc8I4321.hash("123456789"));
 
@@ -269,7 +288,7 @@ test "CRC-8/I-432-1" {
 }
 
 test "CRC-8/I-CODE" {
-    const Crc8ICode = catalog.Crc8ICode;
+    const Crc8ICode = crc.Crc8ICode;
 
     try testing.expectEqual(@as(u8, 0x7e), Crc8ICode.hash("123456789"));
 
@@ -280,7 +299,7 @@ test "CRC-8/I-CODE" {
 }
 
 test "CRC-8/LTE" {
-    const Crc8Lte = catalog.Crc8Lte;
+    const Crc8Lte = crc.Crc8Lte;
 
     try testing.expectEqual(@as(u8, 0xea), Crc8Lte.hash("123456789"));
 
@@ -291,7 +310,7 @@ test "CRC-8/LTE" {
 }
 
 test "CRC-8/MAXIM-DOW" {
-    const Crc8MaximDow = catalog.Crc8MaximDow;
+    const Crc8MaximDow = crc.Crc8MaximDow;
 
     try testing.expectEqual(@as(u8, 0xa1), Crc8MaximDow.hash("123456789"));
 
@@ -302,7 +321,7 @@ test "CRC-8/MAXIM-DOW" {
 }
 
 test "CRC-8/MIFARE-MAD" {
-    const Crc8MifareMad = catalog.Crc8MifareMad;
+    const Crc8MifareMad = crc.Crc8MifareMad;
 
     try testing.expectEqual(@as(u8, 0x99), Crc8MifareMad.hash("123456789"));
 
@@ -313,7 +332,7 @@ test "CRC-8/MIFARE-MAD" {
 }
 
 test "CRC-8/NRSC-5" {
-    const Crc8Nrsc5 = catalog.Crc8Nrsc5;
+    const Crc8Nrsc5 = crc.Crc8Nrsc5;
 
     try testing.expectEqual(@as(u8, 0xf7), Crc8Nrsc5.hash("123456789"));
 
@@ -324,7 +343,7 @@ test "CRC-8/NRSC-5" {
 }
 
 test "CRC-8/OPENSAFETY" {
-    const Crc8Opensafety = catalog.Crc8Opensafety;
+    const Crc8Opensafety = crc.Crc8Opensafety;
 
     try testing.expectEqual(@as(u8, 0x3e), Crc8Opensafety.hash("123456789"));
 
@@ -335,7 +354,7 @@ test "CRC-8/OPENSAFETY" {
 }
 
 test "CRC-8/ROHC" {
-    const Crc8Rohc = catalog.Crc8Rohc;
+    const Crc8Rohc = crc.Crc8Rohc;
 
     try testing.expectEqual(@as(u8, 0xd0), Crc8Rohc.hash("123456789"));
 
@@ -346,7 +365,7 @@ test "CRC-8/ROHC" {
 }
 
 test "CRC-8/SAE-J1850" {
-    const Crc8SaeJ1850 = catalog.Crc8SaeJ1850;
+    const Crc8SaeJ1850 = crc.Crc8SaeJ1850;
 
     try testing.expectEqual(@as(u8, 0x4b), Crc8SaeJ1850.hash("123456789"));
 
@@ -357,7 +376,7 @@ test "CRC-8/SAE-J1850" {
 }
 
 test "CRC-8/SMBUS" {
-    const Crc8Smbus = catalog.Crc8Smbus;
+    const Crc8Smbus = crc.Crc8Smbus;
 
     try testing.expectEqual(@as(u8, 0xf4), Crc8Smbus.hash("123456789"));
 
@@ -368,7 +387,7 @@ test "CRC-8/SMBUS" {
 }
 
 test "CRC-8/TECH-3250" {
-    const Crc8Tech3250 = catalog.Crc8Tech3250;
+    const Crc8Tech3250 = crc.Crc8Tech3250;
 
     try testing.expectEqual(@as(u8, 0x97), Crc8Tech3250.hash("123456789"));
 
@@ -379,7 +398,7 @@ test "CRC-8/TECH-3250" {
 }
 
 test "CRC-8/WCDMA" {
-    const Crc8Wcdma = catalog.Crc8Wcdma;
+    const Crc8Wcdma = crc.Crc8Wcdma;
 
     try testing.expectEqual(@as(u8, 0x25), Crc8Wcdma.hash("123456789"));
 
@@ -390,7 +409,7 @@ test "CRC-8/WCDMA" {
 }
 
 test "CRC-10/ATM" {
-    const Crc10Atm = catalog.Crc10Atm;
+    const Crc10Atm = crc.Crc10Atm;
 
     try testing.expectEqual(@as(u10, 0x199), Crc10Atm.hash("123456789"));
 
@@ -401,7 +420,7 @@ test "CRC-10/ATM" {
 }
 
 test "CRC-10/CDMA2000" {
-    const Crc10Cdma2000 = catalog.Crc10Cdma2000;
+    const Crc10Cdma2000 = crc.Crc10Cdma2000;
 
     try testing.expectEqual(@as(u10, 0x233), Crc10Cdma2000.hash("123456789"));
 
@@ -412,7 +431,7 @@ test "CRC-10/CDMA2000" {
 }
 
 test "CRC-10/GSM" {
-    const Crc10Gsm = catalog.Crc10Gsm;
+    const Crc10Gsm = crc.Crc10Gsm;
 
     try testing.expectEqual(@as(u10, 0x12a), Crc10Gsm.hash("123456789"));
 
@@ -423,7 +442,7 @@ test "CRC-10/GSM" {
 }
 
 test "CRC-11/FLEXRAY" {
-    const Crc11Flexray = catalog.Crc11Flexray;
+    const Crc11Flexray = crc.Crc11Flexray;
 
     try testing.expectEqual(@as(u11, 0x5a3), Crc11Flexray.hash("123456789"));
 
@@ -434,7 +453,7 @@ test "CRC-11/FLEXRAY" {
 }
 
 test "CRC-11/UMTS" {
-    const Crc11Umts = catalog.Crc11Umts;
+    const Crc11Umts = crc.Crc11Umts;
 
     try testing.expectEqual(@as(u11, 0x061), Crc11Umts.hash("123456789"));
 
@@ -445,7 +464,7 @@ test "CRC-11/UMTS" {
 }
 
 test "CRC-12/CDMA2000" {
-    const Crc12Cdma2000 = catalog.Crc12Cdma2000;
+    const Crc12Cdma2000 = crc.Crc12Cdma2000;
 
     try testing.expectEqual(@as(u12, 0xd4d), Crc12Cdma2000.hash("123456789"));
 
@@ -456,7 +475,7 @@ test "CRC-12/CDMA2000" {
 }
 
 test "CRC-12/DECT" {
-    const Crc12Dect = catalog.Crc12Dect;
+    const Crc12Dect = crc.Crc12Dect;
 
     try testing.expectEqual(@as(u12, 0xf5b), Crc12Dect.hash("123456789"));
 
@@ -467,7 +486,7 @@ test "CRC-12/DECT" {
 }
 
 test "CRC-12/GSM" {
-    const Crc12Gsm = catalog.Crc12Gsm;
+    const Crc12Gsm = crc.Crc12Gsm;
 
     try testing.expectEqual(@as(u12, 0xb34), Crc12Gsm.hash("123456789"));
 
@@ -478,7 +497,7 @@ test "CRC-12/GSM" {
 }
 
 test "CRC-12/UMTS" {
-    const Crc12Umts = catalog.Crc12Umts;
+    const Crc12Umts = crc.Crc12Umts;
 
     try testing.expectEqual(@as(u12, 0xdaf), Crc12Umts.hash("123456789"));
 
@@ -489,7 +508,7 @@ test "CRC-12/UMTS" {
 }
 
 test "CRC-13/BBC" {
-    const Crc13Bbc = catalog.Crc13Bbc;
+    const Crc13Bbc = crc.Crc13Bbc;
 
     try testing.expectEqual(@as(u13, 0x04fa), Crc13Bbc.hash("123456789"));
 
@@ -500,7 +519,7 @@ test "CRC-13/BBC" {
 }
 
 test "CRC-14/DARC" {
-    const Crc14Darc = catalog.Crc14Darc;
+    const Crc14Darc = crc.Crc14Darc;
 
     try testing.expectEqual(@as(u14, 0x082d), Crc14Darc.hash("123456789"));
 
@@ -511,7 +530,7 @@ test "CRC-14/DARC" {
 }
 
 test "CRC-14/GSM" {
-    const Crc14Gsm = catalog.Crc14Gsm;
+    const Crc14Gsm = crc.Crc14Gsm;
 
     try testing.expectEqual(@as(u14, 0x30ae), Crc14Gsm.hash("123456789"));
 
@@ -522,7 +541,7 @@ test "CRC-14/GSM" {
 }
 
 test "CRC-15/CAN" {
-    const Crc15Can = catalog.Crc15Can;
+    const Crc15Can = crc.Crc15Can;
 
     try testing.expectEqual(@as(u15, 0x059e), Crc15Can.hash("123456789"));
 
@@ -533,7 +552,7 @@ test "CRC-15/CAN" {
 }
 
 test "CRC-15/MPT1327" {
-    const Crc15Mpt1327 = catalog.Crc15Mpt1327;
+    const Crc15Mpt1327 = crc.Crc15Mpt1327;
 
     try testing.expectEqual(@as(u15, 0x2566), Crc15Mpt1327.hash("123456789"));
 
@@ -544,7 +563,7 @@ test "CRC-15/MPT1327" {
 }
 
 test "CRC-16/ARC" {
-    const Crc16Arc = catalog.Crc16Arc;
+    const Crc16Arc = crc.Crc16Arc;
 
     try testing.expectEqual(@as(u16, 0xbb3d), Crc16Arc.hash("123456789"));
 
@@ -555,7 +574,7 @@ test "CRC-16/ARC" {
 }
 
 test "CRC-16/CDMA2000" {
-    const Crc16Cdma2000 = catalog.Crc16Cdma2000;
+    const Crc16Cdma2000 = crc.Crc16Cdma2000;
 
     try testing.expectEqual(@as(u16, 0x4c06), Crc16Cdma2000.hash("123456789"));
 
@@ -566,7 +585,7 @@ test "CRC-16/CDMA2000" {
 }
 
 test "CRC-16/CMS" {
-    const Crc16Cms = catalog.Crc16Cms;
+    const Crc16Cms = crc.Crc16Cms;
 
     try testing.expectEqual(@as(u16, 0xaee7), Crc16Cms.hash("123456789"));
 
@@ -577,7 +596,7 @@ test "CRC-16/CMS" {
 }
 
 test "CRC-16/DDS-110" {
-    const Crc16Dds110 = catalog.Crc16Dds110;
+    const Crc16Dds110 = crc.Crc16Dds110;
 
     try testing.expectEqual(@as(u16, 0x9ecf), Crc16Dds110.hash("123456789"));
 
@@ -588,7 +607,7 @@ test "CRC-16/DDS-110" {
 }
 
 test "CRC-16/DECT-R" {
-    const Crc16DectR = catalog.Crc16DectR;
+    const Crc16DectR = crc.Crc16DectR;
 
     try testing.expectEqual(@as(u16, 0x007e), Crc16DectR.hash("123456789"));
 
@@ -599,7 +618,7 @@ test "CRC-16/DECT-R" {
 }
 
 test "CRC-16/DECT-X" {
-    const Crc16DectX = catalog.Crc16DectX;
+    const Crc16DectX = crc.Crc16DectX;
 
     try testing.expectEqual(@as(u16, 0x007f), Crc16DectX.hash("123456789"));
 
@@ -610,7 +629,7 @@ test "CRC-16/DECT-X" {
 }
 
 test "CRC-16/DNP" {
-    const Crc16Dnp = catalog.Crc16Dnp;
+    const Crc16Dnp = crc.Crc16Dnp;
 
     try testing.expectEqual(@as(u16, 0xea82), Crc16Dnp.hash("123456789"));
 
@@ -621,7 +640,7 @@ test "CRC-16/DNP" {
 }
 
 test "CRC-16/EN-13757" {
-    const Crc16En13757 = catalog.Crc16En13757;
+    const Crc16En13757 = crc.Crc16En13757;
 
     try testing.expectEqual(@as(u16, 0xc2b7), Crc16En13757.hash("123456789"));
 
@@ -632,7 +651,7 @@ test "CRC-16/EN-13757" {
 }
 
 test "CRC-16/GENIBUS" {
-    const Crc16Genibus = catalog.Crc16Genibus;
+    const Crc16Genibus = crc.Crc16Genibus;
 
     try testing.expectEqual(@as(u16, 0xd64e), Crc16Genibus.hash("123456789"));
 
@@ -643,7 +662,7 @@ test "CRC-16/GENIBUS" {
 }
 
 test "CRC-16/GSM" {
-    const Crc16Gsm = catalog.Crc16Gsm;
+    const Crc16Gsm = crc.Crc16Gsm;
 
     try testing.expectEqual(@as(u16, 0xce3c), Crc16Gsm.hash("123456789"));
 
@@ -654,7 +673,7 @@ test "CRC-16/GSM" {
 }
 
 test "CRC-16/IBM-3740" {
-    const Crc16Ibm3740 = catalog.Crc16Ibm3740;
+    const Crc16Ibm3740 = crc.Crc16Ibm3740;
 
     try testing.expectEqual(@as(u16, 0x29b1), Crc16Ibm3740.hash("123456789"));
 
@@ -665,7 +684,7 @@ test "CRC-16/IBM-3740" {
 }
 
 test "CRC-16/IBM-SDLC" {
-    const Crc16IbmSdlc = catalog.Crc16IbmSdlc;
+    const Crc16IbmSdlc = crc.Crc16IbmSdlc;
 
     try testing.expectEqual(@as(u16, 0x906e), Crc16IbmSdlc.hash("123456789"));
 
@@ -676,7 +695,7 @@ test "CRC-16/IBM-SDLC" {
 }
 
 test "CRC-16/ISO-IEC-14443-3-A" {
-    const Crc16IsoIec144433A = catalog.Crc16IsoIec144433A;
+    const Crc16IsoIec144433A = crc.Crc16IsoIec144433A;
 
     try testing.expectEqual(@as(u16, 0xbf05), Crc16IsoIec144433A.hash("123456789"));
 
@@ -687,7 +706,7 @@ test "CRC-16/ISO-IEC-14443-3-A" {
 }
 
 test "CRC-16/KERMIT" {
-    const Crc16Kermit = catalog.Crc16Kermit;
+    const Crc16Kermit = crc.Crc16Kermit;
 
     try testing.expectEqual(@as(u16, 0x2189), Crc16Kermit.hash("123456789"));
 
@@ -698,7 +717,7 @@ test "CRC-16/KERMIT" {
 }
 
 test "CRC-16/LJ1200" {
-    const Crc16Lj1200 = catalog.Crc16Lj1200;
+    const Crc16Lj1200 = crc.Crc16Lj1200;
 
     try testing.expectEqual(@as(u16, 0xbdf4), Crc16Lj1200.hash("123456789"));
 
@@ -709,7 +728,7 @@ test "CRC-16/LJ1200" {
 }
 
 test "CRC-16/M17" {
-    const Crc16M17 = catalog.Crc16M17;
+    const Crc16M17 = crc.Crc16M17;
 
     try testing.expectEqual(@as(u16, 0x772b), Crc16M17.hash("123456789"));
 
@@ -720,7 +739,7 @@ test "CRC-16/M17" {
 }
 
 test "CRC-16/MAXIM-DOW" {
-    const Crc16MaximDow = catalog.Crc16MaximDow;
+    const Crc16MaximDow = crc.Crc16MaximDow;
 
     try testing.expectEqual(@as(u16, 0x44c2), Crc16MaximDow.hash("123456789"));
 
@@ -731,7 +750,7 @@ test "CRC-16/MAXIM-DOW" {
 }
 
 test "CRC-16/MCRF4XX" {
-    const Crc16Mcrf4xx = catalog.Crc16Mcrf4xx;
+    const Crc16Mcrf4xx = crc.Crc16Mcrf4xx;
 
     try testing.expectEqual(@as(u16, 0x6f91), Crc16Mcrf4xx.hash("123456789"));
 
@@ -742,7 +761,7 @@ test "CRC-16/MCRF4XX" {
 }
 
 test "CRC-16/MODBUS" {
-    const Crc16Modbus = catalog.Crc16Modbus;
+    const Crc16Modbus = crc.Crc16Modbus;
 
     try testing.expectEqual(@as(u16, 0x4b37), Crc16Modbus.hash("123456789"));
 
@@ -753,7 +772,7 @@ test "CRC-16/MODBUS" {
 }
 
 test "CRC-16/NRSC-5" {
-    const Crc16Nrsc5 = catalog.Crc16Nrsc5;
+    const Crc16Nrsc5 = crc.Crc16Nrsc5;
 
     try testing.expectEqual(@as(u16, 0xa066), Crc16Nrsc5.hash("123456789"));
 
@@ -764,7 +783,7 @@ test "CRC-16/NRSC-5" {
 }
 
 test "CRC-16/OPENSAFETY-A" {
-    const Crc16OpensafetyA = catalog.Crc16OpensafetyA;
+    const Crc16OpensafetyA = crc.Crc16OpensafetyA;
 
     try testing.expectEqual(@as(u16, 0x5d38), Crc16OpensafetyA.hash("123456789"));
 
@@ -775,7 +794,7 @@ test "CRC-16/OPENSAFETY-A" {
 }
 
 test "CRC-16/OPENSAFETY-B" {
-    const Crc16OpensafetyB = catalog.Crc16OpensafetyB;
+    const Crc16OpensafetyB = crc.Crc16OpensafetyB;
 
     try testing.expectEqual(@as(u16, 0x20fe), Crc16OpensafetyB.hash("123456789"));
 
@@ -786,7 +805,7 @@ test "CRC-16/OPENSAFETY-B" {
 }
 
 test "CRC-16/PROFIBUS" {
-    const Crc16Profibus = catalog.Crc16Profibus;
+    const Crc16Profibus = crc.Crc16Profibus;
 
     try testing.expectEqual(@as(u16, 0xa819), Crc16Profibus.hash("123456789"));
 
@@ -797,7 +816,7 @@ test "CRC-16/PROFIBUS" {
 }
 
 test "CRC-16/RIELLO" {
-    const Crc16Riello = catalog.Crc16Riello;
+    const Crc16Riello = crc.Crc16Riello;
 
     try testing.expectEqual(@as(u16, 0x63d0), Crc16Riello.hash("123456789"));
 
@@ -808,7 +827,7 @@ test "CRC-16/RIELLO" {
 }
 
 test "CRC-16/SPI-FUJITSU" {
-    const Crc16SpiFujitsu = catalog.Crc16SpiFujitsu;
+    const Crc16SpiFujitsu = crc.Crc16SpiFujitsu;
 
     try testing.expectEqual(@as(u16, 0xe5cc), Crc16SpiFujitsu.hash("123456789"));
 
@@ -819,7 +838,7 @@ test "CRC-16/SPI-FUJITSU" {
 }
 
 test "CRC-16/T10-DIF" {
-    const Crc16T10Dif = catalog.Crc16T10Dif;
+    const Crc16T10Dif = crc.Crc16T10Dif;
 
     try testing.expectEqual(@as(u16, 0xd0db), Crc16T10Dif.hash("123456789"));
 
@@ -830,7 +849,7 @@ test "CRC-16/T10-DIF" {
 }
 
 test "CRC-16/TELEDISK" {
-    const Crc16Teledisk = catalog.Crc16Teledisk;
+    const Crc16Teledisk = crc.Crc16Teledisk;
 
     try testing.expectEqual(@as(u16, 0x0fb3), Crc16Teledisk.hash("123456789"));
 
@@ -841,7 +860,7 @@ test "CRC-16/TELEDISK" {
 }
 
 test "CRC-16/TMS37157" {
-    const Crc16Tms37157 = catalog.Crc16Tms37157;
+    const Crc16Tms37157 = crc.Crc16Tms37157;
 
     try testing.expectEqual(@as(u16, 0x26b1), Crc16Tms37157.hash("123456789"));
 
@@ -852,7 +871,7 @@ test "CRC-16/TMS37157" {
 }
 
 test "CRC-16/UMTS" {
-    const Crc16Umts = catalog.Crc16Umts;
+    const Crc16Umts = crc.Crc16Umts;
 
     try testing.expectEqual(@as(u16, 0xfee8), Crc16Umts.hash("123456789"));
 
@@ -863,7 +882,7 @@ test "CRC-16/UMTS" {
 }
 
 test "CRC-16/USB" {
-    const Crc16Usb = catalog.Crc16Usb;
+    const Crc16Usb = crc.Crc16Usb;
 
     try testing.expectEqual(@as(u16, 0xb4c8), Crc16Usb.hash("123456789"));
 
@@ -874,7 +893,7 @@ test "CRC-16/USB" {
 }
 
 test "CRC-16/XMODEM" {
-    const Crc16Xmodem = catalog.Crc16Xmodem;
+    const Crc16Xmodem = crc.Crc16Xmodem;
 
     try testing.expectEqual(@as(u16, 0x31c3), Crc16Xmodem.hash("123456789"));
 
@@ -885,7 +904,7 @@ test "CRC-16/XMODEM" {
 }
 
 test "CRC-17/CAN-FD" {
-    const Crc17CanFd = catalog.Crc17CanFd;
+    const Crc17CanFd = crc.Crc17CanFd;
 
     try testing.expectEqual(@as(u17, 0x04f03), Crc17CanFd.hash("123456789"));
 
@@ -896,7 +915,7 @@ test "CRC-17/CAN-FD" {
 }
 
 test "CRC-21/CAN-FD" {
-    const Crc21CanFd = catalog.Crc21CanFd;
+    const Crc21CanFd = crc.Crc21CanFd;
 
     try testing.expectEqual(@as(u21, 0x0ed841), Crc21CanFd.hash("123456789"));
 
@@ -907,7 +926,7 @@ test "CRC-21/CAN-FD" {
 }
 
 test "CRC-24/BLE" {
-    const Crc24Ble = catalog.Crc24Ble;
+    const Crc24Ble = crc.Crc24Ble;
 
     try testing.expectEqual(@as(u24, 0xc25a56), Crc24Ble.hash("123456789"));
 
@@ -918,7 +937,7 @@ test "CRC-24/BLE" {
 }
 
 test "CRC-24/FLEXRAY-A" {
-    const Crc24FlexrayA = catalog.Crc24FlexrayA;
+    const Crc24FlexrayA = crc.Crc24FlexrayA;
 
     try testing.expectEqual(@as(u24, 0x7979bd), Crc24FlexrayA.hash("123456789"));
 
@@ -929,7 +948,7 @@ test "CRC-24/FLEXRAY-A" {
 }
 
 test "CRC-24/FLEXRAY-B" {
-    const Crc24FlexrayB = catalog.Crc24FlexrayB;
+    const Crc24FlexrayB = crc.Crc24FlexrayB;
 
     try testing.expectEqual(@as(u24, 0x1f23b8), Crc24FlexrayB.hash("123456789"));
 
@@ -940,7 +959,7 @@ test "CRC-24/FLEXRAY-B" {
 }
 
 test "CRC-24/INTERLAKEN" {
-    const Crc24Interlaken = catalog.Crc24Interlaken;
+    const Crc24Interlaken = crc.Crc24Interlaken;
 
     try testing.expectEqual(@as(u24, 0xb4f3e6), Crc24Interlaken.hash("123456789"));
 
@@ -951,7 +970,7 @@ test "CRC-24/INTERLAKEN" {
 }
 
 test "CRC-24/LTE-A" {
-    const Crc24LteA = catalog.Crc24LteA;
+    const Crc24LteA = crc.Crc24LteA;
 
     try testing.expectEqual(@as(u24, 0xcde703), Crc24LteA.hash("123456789"));
 
@@ -962,7 +981,7 @@ test "CRC-24/LTE-A" {
 }
 
 test "CRC-24/LTE-B" {
-    const Crc24LteB = catalog.Crc24LteB;
+    const Crc24LteB = crc.Crc24LteB;
 
     try testing.expectEqual(@as(u24, 0x23ef52), Crc24LteB.hash("123456789"));
 
@@ -973,7 +992,7 @@ test "CRC-24/LTE-B" {
 }
 
 test "CRC-24/OPENPGP" {
-    const Crc24Openpgp = catalog.Crc24Openpgp;
+    const Crc24Openpgp = crc.Crc24Openpgp;
 
     try testing.expectEqual(@as(u24, 0x21cf02), Crc24Openpgp.hash("123456789"));
 
@@ -984,7 +1003,7 @@ test "CRC-24/OPENPGP" {
 }
 
 test "CRC-24/OS-9" {
-    const Crc24Os9 = catalog.Crc24Os9;
+    const Crc24Os9 = crc.Crc24Os9;
 
     try testing.expectEqual(@as(u24, 0x200fa5), Crc24Os9.hash("123456789"));
 
@@ -995,7 +1014,7 @@ test "CRC-24/OS-9" {
 }
 
 test "CRC-30/CDMA" {
-    const Crc30Cdma = catalog.Crc30Cdma;
+    const Crc30Cdma = crc.Crc30Cdma;
 
     try testing.expectEqual(@as(u30, 0x04c34abf), Crc30Cdma.hash("123456789"));
 
@@ -1006,7 +1025,7 @@ test "CRC-30/CDMA" {
 }
 
 test "CRC-31/PHILIPS" {
-    const Crc31Philips = catalog.Crc31Philips;
+    const Crc31Philips = crc.Crc31Philips;
 
     try testing.expectEqual(@as(u31, 0x0ce9e46c), Crc31Philips.hash("123456789"));
 
@@ -1017,7 +1036,7 @@ test "CRC-31/PHILIPS" {
 }
 
 test "CRC-32/AIXM" {
-    const Crc32Aixm = catalog.Crc32Aixm;
+    const Crc32Aixm = crc.Crc32Aixm;
 
     try testing.expectEqual(@as(u32, 0x3010bf7f), Crc32Aixm.hash("123456789"));
 
@@ -1028,7 +1047,7 @@ test "CRC-32/AIXM" {
 }
 
 test "CRC-32/AUTOSAR" {
-    const Crc32Autosar = catalog.Crc32Autosar;
+    const Crc32Autosar = crc.Crc32Autosar;
 
     try testing.expectEqual(@as(u32, 0x1697d06a), Crc32Autosar.hash("123456789"));
 
@@ -1039,7 +1058,7 @@ test "CRC-32/AUTOSAR" {
 }
 
 test "CRC-32/BASE91-D" {
-    const Crc32Base91D = catalog.Crc32Base91D;
+    const Crc32Base91D = crc.Crc32Base91D;
 
     try testing.expectEqual(@as(u32, 0x87315576), Crc32Base91D.hash("123456789"));
 
@@ -1050,7 +1069,7 @@ test "CRC-32/BASE91-D" {
 }
 
 test "CRC-32/BZIP2" {
-    const Crc32Bzip2 = catalog.Crc32Bzip2;
+    const Crc32Bzip2 = crc.Crc32Bzip2;
 
     try testing.expectEqual(@as(u32, 0xfc891918), Crc32Bzip2.hash("123456789"));
 
@@ -1061,7 +1080,7 @@ test "CRC-32/BZIP2" {
 }
 
 test "CRC-32/CD-ROM-EDC" {
-    const Crc32CdRomEdc = catalog.Crc32CdRomEdc;
+    const Crc32CdRomEdc = crc.Crc32CdRomEdc;
 
     try testing.expectEqual(@as(u32, 0x6ec2edc4), Crc32CdRomEdc.hash("123456789"));
 
@@ -1072,7 +1091,7 @@ test "CRC-32/CD-ROM-EDC" {
 }
 
 test "CRC-32/CKSUM" {
-    const Crc32Cksum = catalog.Crc32Cksum;
+    const Crc32Cksum = crc.Crc32Cksum;
 
     try testing.expectEqual(@as(u32, 0x765e7680), Crc32Cksum.hash("123456789"));
 
@@ -1083,7 +1102,7 @@ test "CRC-32/CKSUM" {
 }
 
 test "CRC-32/ISCSI" {
-    const Crc32Iscsi = catalog.Crc32Iscsi;
+    const Crc32Iscsi = crc.Crc32Iscsi;
 
     try testing.expectEqual(@as(u32, 0xe3069283), Crc32Iscsi.hash("123456789"));
 
@@ -1094,7 +1113,7 @@ test "CRC-32/ISCSI" {
 }
 
 test "CRC-32/ISO-HDLC" {
-    const Crc32IsoHdlc = catalog.Crc32IsoHdlc;
+    const Crc32IsoHdlc = crc.Crc32IsoHdlc;
 
     try testing.expectEqual(@as(u32, 0xcbf43926), Crc32IsoHdlc.hash("123456789"));
 
@@ -1105,7 +1124,7 @@ test "CRC-32/ISO-HDLC" {
 }
 
 test "CRC-32/JAMCRC" {
-    const Crc32Jamcrc = catalog.Crc32Jamcrc;
+    const Crc32Jamcrc = crc.Crc32Jamcrc;
 
     try testing.expectEqual(@as(u32, 0x340bc6d9), Crc32Jamcrc.hash("123456789"));
 
@@ -1116,7 +1135,7 @@ test "CRC-32/JAMCRC" {
 }
 
 test "CRC-32/MEF" {
-    const Crc32Mef = catalog.Crc32Mef;
+    const Crc32Mef = crc.Crc32Mef;
 
     try testing.expectEqual(@as(u32, 0xd2c22f51), Crc32Mef.hash("123456789"));
 
@@ -1127,7 +1146,7 @@ test "CRC-32/MEF" {
 }
 
 test "CRC-32/MPEG-2" {
-    const Crc32Mpeg2 = catalog.Crc32Mpeg2;
+    const Crc32Mpeg2 = crc.Crc32Mpeg2;
 
     try testing.expectEqual(@as(u32, 0x0376e6e7), Crc32Mpeg2.hash("123456789"));
 
@@ -1138,7 +1157,7 @@ test "CRC-32/MPEG-2" {
 }
 
 test "CRC-32/XFER" {
-    const Crc32Xfer = catalog.Crc32Xfer;
+    const Crc32Xfer = crc.Crc32Xfer;
 
     try testing.expectEqual(@as(u32, 0xbd0be338), Crc32Xfer.hash("123456789"));
 
@@ -1149,7 +1168,7 @@ test "CRC-32/XFER" {
 }
 
 test "CRC-40/GSM" {
-    const Crc40Gsm = catalog.Crc40Gsm;
+    const Crc40Gsm = crc.Crc40Gsm;
 
     try testing.expectEqual(@as(u40, 0xd4164fc646), Crc40Gsm.hash("123456789"));
 
@@ -1160,7 +1179,7 @@ test "CRC-40/GSM" {
 }
 
 test "CRC-64/ECMA-182" {
-    const Crc64Ecma182 = catalog.Crc64Ecma182;
+    const Crc64Ecma182 = crc.Crc64Ecma182;
 
     try testing.expectEqual(@as(u64, 0x6c40df5f0b497347), Crc64Ecma182.hash("123456789"));
 
@@ -1171,7 +1190,7 @@ test "CRC-64/ECMA-182" {
 }
 
 test "CRC-64/GO-ISO" {
-    const Crc64GoIso = catalog.Crc64GoIso;
+    const Crc64GoIso = crc.Crc64GoIso;
 
     try testing.expectEqual(@as(u64, 0xb90956c775a41001), Crc64GoIso.hash("123456789"));
 
@@ -1182,7 +1201,7 @@ test "CRC-64/GO-ISO" {
 }
 
 test "CRC-64/MS" {
-    const Crc64Ms = catalog.Crc64Ms;
+    const Crc64Ms = crc.Crc64Ms;
 
     try testing.expectEqual(@as(u64, 0x75d4b74f024eceea), Crc64Ms.hash("123456789"));
 
@@ -1193,7 +1212,7 @@ test "CRC-64/MS" {
 }
 
 test "CRC-64/REDIS" {
-    const Crc64Redis = catalog.Crc64Redis;
+    const Crc64Redis = crc.Crc64Redis;
 
     try testing.expectEqual(@as(u64, 0xe9c6d914c4b8d9ca), Crc64Redis.hash("123456789"));
 
@@ -1204,7 +1223,7 @@ test "CRC-64/REDIS" {
 }
 
 test "CRC-64/WE" {
-    const Crc64We = catalog.Crc64We;
+    const Crc64We = crc.Crc64We;
 
     try testing.expectEqual(@as(u64, 0x62ec59e3f1a4f00a), Crc64We.hash("123456789"));
 
@@ -1215,7 +1234,7 @@ test "CRC-64/WE" {
 }
 
 test "CRC-64/XZ" {
-    const Crc64Xz = catalog.Crc64Xz;
+    const Crc64Xz = crc.Crc64Xz;
 
     try testing.expectEqual(@as(u64, 0x995dc9bbdf1939fa), Crc64Xz.hash("123456789"));
 
@@ -1226,7 +1245,7 @@ test "CRC-64/XZ" {
 }
 
 test "CRC-82/DARC" {
-    const Crc82Darc = catalog.Crc82Darc;
+    const Crc82Darc = crc.Crc82Darc;
 
     try testing.expectEqual(@as(u82, 0x09ea83f625023801fd612), Crc82Darc.hash("123456789"));
 
lib/std/hash/crc.zig
@@ -1,285 +1,911 @@
-// There are two implementations of CRC32 implemented with the following key characteristics:
-//
-// - Crc32WithPoly uses 8Kb of tables but is ~10x faster than the small method.
-//
-// - Crc32SmallWithPoly uses only 64 bytes of memory but is slower. Be aware that this is
-//   still moderately fast just slow relative to the slicing approach.
-
-const std = @import("std");
-const builtin = @import("builtin");
-const debug = std.debug;
-const testing = std.testing;
-
-pub usingnamespace @import("crc/catalog.zig");
-
-pub fn Algorithm(comptime W: type) type {
-    return struct {
-        polynomial: W,
-        initial: W,
-        reflect_input: bool,
-        reflect_output: bool,
-        xor_output: W,
-    };
-}
+//! This file is auto-generated by tools/update_crc_catalog.zig.
 
-pub fn Crc(comptime W: type, comptime algorithm: Algorithm(W)) type {
-    return struct {
-        const Self = @This();
-        const I = if (@bitSizeOf(W) < 8) u8 else W;
-        const lookup_table = blk: {
-            @setEvalBranchQuota(2500);
-
-            const poly = if (algorithm.reflect_input)
-                @bitReverse(@as(I, algorithm.polynomial)) >> (@bitSizeOf(I) - @bitSizeOf(W))
-            else
-                @as(I, algorithm.polynomial) << (@bitSizeOf(I) - @bitSizeOf(W));
-
-            var table: [256]I = undefined;
-            for (&table, 0..) |*e, i| {
-                var crc: I = i;
-                if (algorithm.reflect_input) {
-                    var j: usize = 0;
-                    while (j < 8) : (j += 1) {
-                        crc = (crc >> 1) ^ ((crc & 1) * poly);
-                    }
-                } else {
-                    crc <<= @bitSizeOf(I) - 8;
-                    var j: usize = 0;
-                    while (j < 8) : (j += 1) {
-                        crc = (crc << 1) ^ (((crc >> (@bitSizeOf(I) - 1)) & 1) * poly);
-                    }
-                }
-                e.* = crc;
-            }
-            break :blk table;
-        };
-
-        crc: I,
-
-        pub fn init() Self {
-            const initial = if (algorithm.reflect_input)
-                @bitReverse(@as(I, algorithm.initial)) >> (@bitSizeOf(I) - @bitSizeOf(W))
-            else
-                @as(I, algorithm.initial) << (@bitSizeOf(I) - @bitSizeOf(W));
-            return Self{ .crc = initial };
-        }
-
-        inline fn tableEntry(index: I) I {
-            return lookup_table[@as(u8, @intCast(index & 0xFF))];
-        }
-
-        pub fn update(self: *Self, bytes: []const u8) void {
-            var i: usize = 0;
-            if (@bitSizeOf(I) <= 8) {
-                while (i < bytes.len) : (i += 1) {
-                    self.crc = tableEntry(self.crc ^ bytes[i]);
-                }
-            } else if (algorithm.reflect_input) {
-                while (i < bytes.len) : (i += 1) {
-                    const table_index = self.crc ^ bytes[i];
-                    self.crc = tableEntry(table_index) ^ (self.crc >> 8);
-                }
-            } else {
-                while (i < bytes.len) : (i += 1) {
-                    const table_index = (self.crc >> (@bitSizeOf(I) - 8)) ^ bytes[i];
-                    self.crc = tableEntry(table_index) ^ (self.crc << 8);
-                }
-            }
-        }
-
-        pub fn final(self: Self) W {
-            var c = self.crc;
-            if (algorithm.reflect_input != algorithm.reflect_output) {
-                c = @bitReverse(c);
-            }
-            if (!algorithm.reflect_output) {
-                c >>= @bitSizeOf(I) - @bitSizeOf(W);
-            }
-            return @as(W, @intCast(c ^ algorithm.xor_output));
-        }
-
-        pub fn hash(bytes: []const u8) W {
-            var c = Self.init();
-            c.update(bytes);
-            return c.final();
-        }
-    };
-}
+const impl = @import("crc/impl.zig");
 
-pub const Polynomial = enum(u32) {
-    IEEE = 0xedb88320,
-    Castagnoli = 0x82f63b78,
-    Koopman = 0xeb31d82e,
-    _,
-};
+pub const Crc = impl.Crc;
+pub const Polynomial = impl.Polynomial;
+pub const Crc32WithPoly = impl.Crc32WithPoly;
+pub const Crc32SmallWithPoly = impl.Crc32SmallWithPoly;
 
 // IEEE is by far the most common CRC and so is aliased by default.
 pub const Crc32 = Crc32WithPoly(.IEEE);
 
-// slicing-by-8 crc32 implementation.
-pub fn Crc32WithPoly(comptime poly: Polynomial) type {
-    return struct {
-        const Self = @This();
-        const lookup_tables = block: {
-            @setEvalBranchQuota(20000);
-            var tables: [8][256]u32 = undefined;
-
-            for (&tables[0], 0..) |*e, i| {
-                var crc = @as(u32, @intCast(i));
-                var j: usize = 0;
-                while (j < 8) : (j += 1) {
-                    if (crc & 1 == 1) {
-                        crc = (crc >> 1) ^ @intFromEnum(poly);
-                    } else {
-                        crc = (crc >> 1);
-                    }
-                }
-                e.* = crc;
-            }
-
-            var i: usize = 0;
-            while (i < 256) : (i += 1) {
-                var crc = tables[0][i];
-                var j: usize = 1;
-                while (j < 8) : (j += 1) {
-                    const index: u8 = @truncate(crc);
-                    crc = tables[0][index] ^ (crc >> 8);
-                    tables[j][i] = crc;
-                }
-            }
-
-            break :block tables;
-        };
-
-        crc: u32,
-
-        pub fn init() Self {
-            return Self{ .crc = 0xffffffff };
-        }
-
-        pub fn update(self: *Self, input: []const u8) void {
-            var i: usize = 0;
-            while (i + 8 <= input.len) : (i += 8) {
-                const p = input[i..][0..8];
-
-                // Unrolling this way gives ~50Mb/s increase
-                self.crc ^= std.mem.readInt(u32, p[0..4], .little);
-
-                self.crc =
-                    lookup_tables[0][p[7]] ^
-                    lookup_tables[1][p[6]] ^
-                    lookup_tables[2][p[5]] ^
-                    lookup_tables[3][p[4]] ^
-                    lookup_tables[4][@as(u8, @truncate(self.crc >> 24))] ^
-                    lookup_tables[5][@as(u8, @truncate(self.crc >> 16))] ^
-                    lookup_tables[6][@as(u8, @truncate(self.crc >> 8))] ^
-                    lookup_tables[7][@as(u8, @truncate(self.crc >> 0))];
-            }
-
-            while (i < input.len) : (i += 1) {
-                const index = @as(u8, @truncate(self.crc)) ^ input[i];
-                self.crc = (self.crc >> 8) ^ lookup_tables[0][index];
-            }
-        }
-
-        pub fn final(self: *Self) u32 {
-            return ~self.crc;
-        }
-
-        pub fn hash(input: []const u8) u32 {
-            var c = Self.init();
-            c.update(input);
-            return c.final();
-        }
-    };
-}
-
-const verify = @import("verify.zig");
-
-test "crc32 ieee" {
-    const Crc32Ieee = Crc32WithPoly(.IEEE);
-
-    try testing.expect(Crc32Ieee.hash("") == 0x00000000);
-    try testing.expect(Crc32Ieee.hash("a") == 0xe8b7be43);
-    try testing.expect(Crc32Ieee.hash("abc") == 0x352441c2);
-}
-
-test "crc32 castagnoli" {
-    const Crc32Castagnoli = Crc32WithPoly(.Castagnoli);
-
-    try testing.expect(Crc32Castagnoli.hash("") == 0x00000000);
-    try testing.expect(Crc32Castagnoli.hash("a") == 0xc1d04330);
-    try testing.expect(Crc32Castagnoli.hash("abc") == 0x364b3fb7);
-}
-
-test "crc32 iterative" {
-    try verify.iterativeApi(Crc32WithPoly(.IEEE));
-}
-
-// half-byte lookup table implementation.
-pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type {
-    return struct {
-        const Self = @This();
-        const lookup_table = block: {
-            var table: [16]u32 = undefined;
-
-            for (&table, 0..) |*e, i| {
-                var crc = @as(u32, @intCast(i * 16));
-                var j: usize = 0;
-                while (j < 8) : (j += 1) {
-                    if (crc & 1 == 1) {
-                        crc = (crc >> 1) ^ @intFromEnum(poly);
-                    } else {
-                        crc = (crc >> 1);
-                    }
-                }
-                e.* = crc;
-            }
-
-            break :block table;
-        };
-
-        crc: u32,
-
-        pub fn init() Self {
-            return Self{ .crc = 0xffffffff };
-        }
-
-        pub fn update(self: *Self, input: []const u8) void {
-            for (input) |b| {
-                self.crc = lookup_table[@as(u4, @truncate(self.crc ^ (b >> 0)))] ^ (self.crc >> 4);
-                self.crc = lookup_table[@as(u4, @truncate(self.crc ^ (b >> 4)))] ^ (self.crc >> 4);
-            }
-        }
-
-        pub fn final(self: *Self) u32 {
-            return ~self.crc;
-        }
-
-        pub fn hash(input: []const u8) u32 {
-            var c = Self.init();
-            c.update(input);
-            return c.final();
-        }
-    };
-}
-
-test "small crc32 iterative" {
-    try verify.iterativeApi(Crc32SmallWithPoly(.IEEE));
+test {
+    _ = @import("crc/test.zig");
 }
 
-test "small crc32 ieee" {
-    const Crc32Ieee = Crc32SmallWithPoly(.IEEE);
-
-    try testing.expect(Crc32Ieee.hash("") == 0x00000000);
-    try testing.expect(Crc32Ieee.hash("a") == 0xe8b7be43);
-    try testing.expect(Crc32Ieee.hash("abc") == 0x352441c2);
-}
-
-test "small crc32 castagnoli" {
-    const Crc32Castagnoli = Crc32SmallWithPoly(.Castagnoli);
-
-    try testing.expect(Crc32Castagnoli.hash("") == 0x00000000);
-    try testing.expect(Crc32Castagnoli.hash("a") == 0xc1d04330);
-    try testing.expect(Crc32Castagnoli.hash("abc") == 0x364b3fb7);
-}
+pub const Crc3Gsm = Crc(u3, .{
+    .polynomial = 0x3,
+    .initial = 0x0,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x7,
+});
+
+pub const Crc3Rohc = Crc(u3, .{
+    .polynomial = 0x3,
+    .initial = 0x7,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0,
+});
+
+pub const Crc4G704 = Crc(u4, .{
+    .polynomial = 0x3,
+    .initial = 0x0,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0,
+});
+
+pub const Crc4Interlaken = Crc(u4, .{
+    .polynomial = 0x3,
+    .initial = 0xf,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xf,
+});
+
+pub const Crc5EpcC1g2 = Crc(u5, .{
+    .polynomial = 0x09,
+    .initial = 0x09,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc5G704 = Crc(u5, .{
+    .polynomial = 0x15,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc5Usb = Crc(u5, .{
+    .polynomial = 0x05,
+    .initial = 0x1f,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x1f,
+});
+
+pub const Crc6Cdma2000A = Crc(u6, .{
+    .polynomial = 0x27,
+    .initial = 0x3f,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc6Cdma2000B = Crc(u6, .{
+    .polynomial = 0x07,
+    .initial = 0x3f,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc6Darc = Crc(u6, .{
+    .polynomial = 0x19,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc6G704 = Crc(u6, .{
+    .polynomial = 0x03,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc6Gsm = Crc(u6, .{
+    .polynomial = 0x2f,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x3f,
+});
+
+pub const Crc7Mmc = Crc(u7, .{
+    .polynomial = 0x09,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc7Rohc = Crc(u7, .{
+    .polynomial = 0x4f,
+    .initial = 0x7f,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc7Umts = Crc(u7, .{
+    .polynomial = 0x45,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Autosar = Crc(u8, .{
+    .polynomial = 0x2f,
+    .initial = 0xff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xff,
+});
+
+pub const Crc8Bluetooth = Crc(u8, .{
+    .polynomial = 0xa7,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Cdma2000 = Crc(u8, .{
+    .polynomial = 0x9b,
+    .initial = 0xff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Darc = Crc(u8, .{
+    .polynomial = 0x39,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc8DvbS2 = Crc(u8, .{
+    .polynomial = 0xd5,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8GsmA = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8GsmB = Crc(u8, .{
+    .polynomial = 0x49,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xff,
+});
+
+pub const Crc8Hitag = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0xff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8I4321 = Crc(u8, .{
+    .polynomial = 0x07,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x55,
+});
+
+pub const Crc8ICode = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0xfd,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Lte = Crc(u8, .{
+    .polynomial = 0x9b,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8MaximDow = Crc(u8, .{
+    .polynomial = 0x31,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc8MifareMad = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0xc7,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Nrsc5 = Crc(u8, .{
+    .polynomial = 0x31,
+    .initial = 0xff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Opensafety = Crc(u8, .{
+    .polynomial = 0x2f,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Rohc = Crc(u8, .{
+    .polynomial = 0x07,
+    .initial = 0xff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc8SaeJ1850 = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0xff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xff,
+});
+
+pub const Crc8Smbus = Crc(u8, .{
+    .polynomial = 0x07,
+    .initial = 0x00,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Tech3250 = Crc(u8, .{
+    .polynomial = 0x1d,
+    .initial = 0xff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc8Wcdma = Crc(u8, .{
+    .polynomial = 0x9b,
+    .initial = 0x00,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00,
+});
+
+pub const Crc10Atm = Crc(u10, .{
+    .polynomial = 0x233,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc10Cdma2000 = Crc(u10, .{
+    .polynomial = 0x3d9,
+    .initial = 0x3ff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc10Gsm = Crc(u10, .{
+    .polynomial = 0x175,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x3ff,
+});
+
+pub const Crc11Flexray = Crc(u11, .{
+    .polynomial = 0x385,
+    .initial = 0x01a,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc11Umts = Crc(u11, .{
+    .polynomial = 0x307,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc12Cdma2000 = Crc(u12, .{
+    .polynomial = 0xf13,
+    .initial = 0xfff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc12Dect = Crc(u12, .{
+    .polynomial = 0x80f,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000,
+});
+
+pub const Crc12Gsm = Crc(u12, .{
+    .polynomial = 0xd31,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xfff,
+});
+
+pub const Crc12Umts = Crc(u12, .{
+    .polynomial = 0x80f,
+    .initial = 0x000,
+    .reflect_input = false,
+    .reflect_output = true,
+    .xor_output = 0x000,
+});
+
+pub const Crc13Bbc = Crc(u13, .{
+    .polynomial = 0x1cf5,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc14Darc = Crc(u14, .{
+    .polynomial = 0x0805,
+    .initial = 0x0000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc14Gsm = Crc(u14, .{
+    .polynomial = 0x202d,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x3fff,
+});
+
+pub const Crc15Can = Crc(u15, .{
+    .polynomial = 0x4599,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc15Mpt1327 = Crc(u15, .{
+    .polynomial = 0x6815,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0001,
+});
+
+pub const Crc16Arc = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0x0000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Cdma2000 = Crc(u16, .{
+    .polynomial = 0xc867,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Cms = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Dds110 = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0x800d,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16DectR = Crc(u16, .{
+    .polynomial = 0x0589,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0001,
+});
+
+pub const Crc16DectX = Crc(u16, .{
+    .polynomial = 0x0589,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Dnp = Crc(u16, .{
+    .polynomial = 0x3d65,
+    .initial = 0x0000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16En13757 = Crc(u16, .{
+    .polynomial = 0x3d65,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Genibus = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Gsm = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Ibm3740 = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16IbmSdlc = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16IsoIec144433A = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xc6c6,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Kermit = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0x0000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Lj1200 = Crc(u16, .{
+    .polynomial = 0x6f63,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16M17 = Crc(u16, .{
+    .polynomial = 0x5935,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16MaximDow = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0x0000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Mcrf4xx = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Modbus = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0xffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Nrsc5 = Crc(u16, .{
+    .polynomial = 0x080b,
+    .initial = 0xffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16OpensafetyA = Crc(u16, .{
+    .polynomial = 0x5935,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16OpensafetyB = Crc(u16, .{
+    .polynomial = 0x755b,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Profibus = Crc(u16, .{
+    .polynomial = 0x1dcf,
+    .initial = 0xffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Riello = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0xb2aa,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16SpiFujitsu = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0x1d0f,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16T10Dif = Crc(u16, .{
+    .polynomial = 0x8bb7,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Teledisk = Crc(u16, .{
+    .polynomial = 0xa097,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Tms37157 = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0x89ec,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Umts = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc16Usb = Crc(u16, .{
+    .polynomial = 0x8005,
+    .initial = 0xffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffff,
+});
+
+pub const Crc16Xmodem = Crc(u16, .{
+    .polynomial = 0x1021,
+    .initial = 0x0000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000,
+});
+
+pub const Crc17CanFd = Crc(u17, .{
+    .polynomial = 0x1685b,
+    .initial = 0x00000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00000,
+});
+
+pub const Crc21CanFd = Crc(u21, .{
+    .polynomial = 0x102899,
+    .initial = 0x000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24Ble = Crc(u24, .{
+    .polynomial = 0x00065b,
+    .initial = 0x555555,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24FlexrayA = Crc(u24, .{
+    .polynomial = 0x5d6dcb,
+    .initial = 0xfedcba,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24FlexrayB = Crc(u24, .{
+    .polynomial = 0x5d6dcb,
+    .initial = 0xabcdef,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24Interlaken = Crc(u24, .{
+    .polynomial = 0x328b63,
+    .initial = 0xffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffff,
+});
+
+pub const Crc24LteA = Crc(u24, .{
+    .polynomial = 0x864cfb,
+    .initial = 0x000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24LteB = Crc(u24, .{
+    .polynomial = 0x800063,
+    .initial = 0x000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24Openpgp = Crc(u24, .{
+    .polynomial = 0x864cfb,
+    .initial = 0xb704ce,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x000000,
+});
+
+pub const Crc24Os9 = Crc(u24, .{
+    .polynomial = 0x800063,
+    .initial = 0xffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffff,
+});
+
+pub const Crc30Cdma = Crc(u30, .{
+    .polynomial = 0x2030b9c7,
+    .initial = 0x3fffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x3fffffff,
+});
+
+pub const Crc31Philips = Crc(u31, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0x7fffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x7fffffff,
+});
+
+pub const Crc32Aixm = Crc(u32, .{
+    .polynomial = 0x814141ab,
+    .initial = 0x00000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc32Autosar = Crc(u32, .{
+    .polynomial = 0xf4acfb13,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32Base91D = Crc(u32, .{
+    .polynomial = 0xa833982b,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32Bzip2 = Crc(u32, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0xffffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32CdRomEdc = Crc(u32, .{
+    .polynomial = 0x8001801b,
+    .initial = 0x00000000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc32Cksum = Crc(u32, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0x00000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32Iscsi = Crc(u32, .{
+    .polynomial = 0x1edc6f41,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32IsoHdlc = Crc(u32, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffff,
+});
+
+pub const Crc32Jamcrc = Crc(u32, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc32Mef = Crc(u32, .{
+    .polynomial = 0x741b8cd7,
+    .initial = 0xffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc32Mpeg2 = Crc(u32, .{
+    .polynomial = 0x04c11db7,
+    .initial = 0xffffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc32Xfer = Crc(u32, .{
+    .polynomial = 0x000000af,
+    .initial = 0x00000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x00000000,
+});
+
+pub const Crc40Gsm = Crc(u40, .{
+    .polynomial = 0x0004820009,
+    .initial = 0x0000000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffffffff,
+});
+
+pub const Crc64Ecma182 = Crc(u64, .{
+    .polynomial = 0x42f0e1eba9ea3693,
+    .initial = 0x0000000000000000,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0x0000000000000000,
+});
+
+pub const Crc64GoIso = Crc(u64, .{
+    .polynomial = 0x000000000000001b,
+    .initial = 0xffffffffffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffffffffffff,
+});
+
+pub const Crc64Ms = Crc(u64, .{
+    .polynomial = 0x259c84cba6426349,
+    .initial = 0xffffffffffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000000000000000,
+});
+
+pub const Crc64Redis = Crc(u64, .{
+    .polynomial = 0xad93d23594c935a9,
+    .initial = 0x0000000000000000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x0000000000000000,
+});
+
+pub const Crc64We = Crc(u64, .{
+    .polynomial = 0x42f0e1eba9ea3693,
+    .initial = 0xffffffffffffffff,
+    .reflect_input = false,
+    .reflect_output = false,
+    .xor_output = 0xffffffffffffffff,
+});
+
+pub const Crc64Xz = Crc(u64, .{
+    .polynomial = 0x42f0e1eba9ea3693,
+    .initial = 0xffffffffffffffff,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0xffffffffffffffff,
+});
+
+pub const Crc82Darc = Crc(u82, .{
+    .polynomial = 0x0308c0111011401440411,
+    .initial = 0x000000000000000000000,
+    .reflect_input = true,
+    .reflect_output = true,
+    .xor_output = 0x000000000000000000000,
+});
tools/update_crc_catalog.zig
@@ -23,11 +23,15 @@ pub fn main() anyerror!void {
     var zig_src_dir = try fs.cwd().openDir(zig_src_root, .{});
     defer zig_src_dir.close();
 
-    const target_sub_path = try fs.path.join(arena, &.{ "lib", "std", "hash", "crc" });
-    var target_dir = try zig_src_dir.makeOpenPath(target_sub_path, .{});
-    defer target_dir.close();
+    const hash_sub_path = try fs.path.join(arena, &.{ "lib", "std", "hash" });
+    var hash_target_dir = try zig_src_dir.makeOpenPath(hash_sub_path, .{});
+    defer hash_target_dir.close();
 
-    var zig_code_file = try target_dir.createFile("catalog.zig", .{});
+    const crc_sub_path = try fs.path.join(arena, &.{ "lib", "std", "hash", "crc" });
+    var crc_target_dir = try zig_src_dir.makeOpenPath(crc_sub_path, .{});
+    defer crc_target_dir.close();
+
+    var zig_code_file = try hash_target_dir.createFile("crc.zig", .{});
     defer zig_code_file.close();
 
     var cbw = std.io.bufferedWriter(zig_code_file.writer());
@@ -37,15 +41,23 @@ pub fn main() anyerror!void {
     try code_writer.writeAll(
         \\//! This file is auto-generated by tools/update_crc_catalog.zig.
         \\
-        \\const Crc = @import("../crc.zig").Crc;
+        \\const impl = @import("crc/impl.zig");
+        \\
+        \\pub const Crc = impl.Crc;
+        \\pub const Polynomial = impl.Polynomial;
+        \\pub const Crc32WithPoly = impl.Crc32WithPoly;
+        \\pub const Crc32SmallWithPoly = impl.Crc32SmallWithPoly;
+        \\
+        \\// IEEE is by far the most common CRC and so is aliased by default.
+        \\pub const Crc32 = Crc32WithPoly(.IEEE);
         \\
         \\test {
-        \\    _ = @import("catalog_test.zig");
+        \\    _ = @import("crc/test.zig");
         \\}
         \\
     );
 
-    var zig_test_file = try target_dir.createFile("catalog_test.zig", .{});
+    var zig_test_file = try crc_target_dir.createFile("test.zig", .{});
     defer zig_test_file.close();
 
     var tbw = std.io.bufferedWriter(zig_test_file.writer());
@@ -57,7 +69,26 @@ pub fn main() anyerror!void {
         \\
         \\const std = @import("std");
         \\const testing = std.testing;
-        \\const catalog = @import("catalog.zig");
+        \\const verify = @import("../verify.zig");
+        \\const crc = @import("../crc.zig");
+        \\
+        \\test "crc32 ieee" {
+        \\    inline for ([2]type{ crc.Crc32WithPoly(.IEEE), crc.Crc32SmallWithPoly(.IEEE) }) |ieee| {
+        \\        try testing.expect(ieee.hash("") == 0x00000000);
+        \\        try testing.expect(ieee.hash("a") == 0xe8b7be43);
+        \\        try testing.expect(ieee.hash("abc") == 0x352441c2);
+        \\        try verify.iterativeApi(ieee);
+        \\    }
+        \\}
+        \\
+        \\test "crc32 castagnoli" {
+        \\    inline for ([2]type{ crc.Crc32WithPoly(.Castagnoli), crc.Crc32SmallWithPoly(.Castagnoli) }) |casta| {
+        \\        try testing.expect(casta.hash("") == 0x00000000);
+        \\        try testing.expect(casta.hash("a") == 0xc1d04330);
+        \\        try testing.expect(casta.hash("abc") == 0x364b3fb7);
+        \\        try verify.iterativeApi(casta);
+        \\    }
+        \\}
         \\
     );
 
@@ -146,7 +177,7 @@ pub fn main() anyerror!void {
         try test_writer.writeAll(try std.fmt.allocPrint(arena,
             \\
             \\test "{0s}" {{
-            \\    const {1s} = catalog.{1s};
+            \\    const {1s} = crc.{1s};
             \\
             \\    try testing.expectEqual(@as(u{2s}, {3s}), {1s}.hash("123456789"));
             \\