]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add makecrct test and clean up makecrct.c code
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 17 Sep 2019 12:12:15 +0000 (14:12 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 20 Sep 2019 20:29:21 +0000 (22:29 +0200)
Update crc32.h tables to match makecrct output.

CMakeLists.txt
crc32.c
crc32.h
crc32_p.h [new file with mode: 0644]
tools/makecrct.c

index 784f02a56ea4eeaf78161db68a1586ce55d7cd8a..30b4ac7426e4e7cbf5188000ee0d4fb5beaba543 100644 (file)
@@ -925,6 +925,18 @@ if (ZLIB_ENABLE_TESTS)
             ${CMAKE_CURRENT_SOURCE_DIR}/trees.h
             ${CMAKE_CURRENT_SOURCE_DIR}/trees._h)
 
+    set(MAKECRCT_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:makecrct>)
+    add_test(NAME makecrct
+        COMMAND ${CMAKE_COMMAND}
+        "-DCOMMAND=${MAKECRCT_COMMAND}"
+        -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/crc32._h
+        -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
+
+    add_test(NAME makecrct-cmp
+        COMMAND ${CMAKE_COMMAND} -E compare_files
+            ${CMAKE_CURRENT_SOURCE_DIR}/crc32.h
+            ${CMAKE_CURRENT_SOURCE_DIR}/crc32._h)
+
     set(GH_361_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:minigzip> -4)
     add_test(NAME GH-361
         COMMAND ${CMAKE_COMMAND}
diff --git a/crc32.c b/crc32.c
index b20221cd71882aca70b937744492ced44d3e2c8e..4959ceac76471a56766a81e926badd5b5b077620 100644 (file)
--- a/crc32.c
+++ b/crc32.c
 #include <inttypes.h>
 #include "deflate.h"
 #include "functable.h"
+#include "crc32_p.h"
 #include "crc32.h"
 
 
 /* Local functions for crc concatenation */
-#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
-static uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec);
 static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2);
 static void crc32_combine_gen_(uint32_t *op, z_off64_t len2);
 
-/* ========================================================================= */
-static uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) {
-    uint32_t sum = 0;
-    while (vec) {
-        if (vec & 1)
-            sum ^= *mat;
-        vec >>= 1;
-        mat++;
-    }
-    return sum;
-}
-
 /* =========================================================================
  * This function can be used by asm versions of crc32()
  */
diff --git a/crc32.h b/crc32.h
index 47ca7c068c1da91921817ec4fc765b0c7548fdd1..6bb2e51c92e4bccf857a0e4cdc20e5fc796f3995 100644 (file)
--- a/crc32.h
+++ b/crc32.h
@@ -2,7 +2,7 @@
 #define CRC32_H_
 
 /* crc32.h -- tables for rapid CRC calculation
- * Generated automatically by crc32.c
+ * Generated automatically by makecrct.c
  */
 
 static const uint32_t crc_table[8][256] =
@@ -444,292 +444,292 @@ static const uint32_t crc_table[8][256] =
 static const uint32_t crc_comb[32][32] =
 {
   {
-    0x77073096UL, 0xee0e612cUL, 0x076dc419UL, 0x0edb8832UL, 0x1db71064UL,
-    0x3b6e20c8UL, 0x76dc4190UL, 0xedb88320UL, 0x00000001UL, 0x00000002UL,
-    0x00000004UL, 0x00000008UL, 0x00000010UL, 0x00000020UL, 0x00000040UL,
-    0x00000080UL, 0x00000100UL, 0x00000200UL, 0x00000400UL, 0x00000800UL,
-    0x00001000UL, 0x00002000UL, 0x00004000UL, 0x00008000UL, 0x00010000UL,
-    0x00020000UL, 0x00040000UL, 0x00080000UL, 0x00100000UL, 0x00200000UL,
-    0x00400000UL, 0x00800000UL
-  },
-  {
-    0x191b3141UL, 0x32366282UL, 0x646cc504UL, 0xc8d98a08UL, 0x4ac21251UL,
-    0x958424a2UL, 0xf0794f05UL, 0x3b83984bUL, 0x77073096UL, 0xee0e612cUL,
-    0x076dc419UL, 0x0edb8832UL, 0x1db71064UL, 0x3b6e20c8UL, 0x76dc4190UL,
-    0xedb88320UL, 0x00000001UL, 0x00000002UL, 0x00000004UL, 0x00000008UL,
-    0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL, 0x00000100UL,
-    0x00000200UL, 0x00000400UL, 0x00000800UL, 0x00001000UL, 0x00002000UL,
-    0x00004000UL, 0x00008000UL
-  },
-  {
-    0xb8bc6765UL, 0xaa09c88bUL, 0x8f629757UL, 0xc5b428efUL, 0x5019579fUL,
-    0xa032af3eUL, 0x9b14583dUL, 0xed59b63bUL, 0x01c26a37UL, 0x0384d46eUL,
-    0x0709a8dcUL, 0x0e1351b8UL, 0x1c26a370UL, 0x384d46e0UL, 0x709a8dc0UL,
-    0xe1351b80UL, 0x191b3141UL, 0x32366282UL, 0x646cc504UL, 0xc8d98a08UL,
-    0x4ac21251UL, 0x958424a2UL, 0xf0794f05UL, 0x3b83984bUL, 0x77073096UL,
-    0xee0e612cUL, 0x076dc419UL, 0x0edb8832UL, 0x1db71064UL, 0x3b6e20c8UL,
-    0x76dc4190UL, 0xedb88320UL
-  },
-  {
-    0xccaa009eUL, 0x4225077dUL, 0x844a0efaUL, 0xd3e51bb5UL, 0x7cbb312bUL,
-    0xf9766256UL, 0x299dc2edUL, 0x533b85daUL, 0xa6770bb4UL, 0x979f1129UL,
-    0xf44f2413UL, 0x33ef4e67UL, 0x67de9cceUL, 0xcfbd399cUL, 0x440b7579UL,
-    0x8816eaf2UL, 0xcb5cd3a5UL, 0x4dc8a10bUL, 0x9b914216UL, 0xec53826dUL,
-    0x03d6029bUL, 0x07ac0536UL, 0x0f580a6cUL, 0x1eb014d8UL, 0x3d6029b0UL,
-    0x7ac05360UL, 0xf580a6c0UL, 0x30704bc1UL, 0x60e09782UL, 0xc1c12f04UL,
-    0x58f35849UL, 0xb1e6b092UL
-  },
-  {
-    0xae689191UL, 0x87a02563UL, 0xd4314c87UL, 0x73139f4fUL, 0xe6273e9eUL,
-    0x173f7b7dUL, 0x2e7ef6faUL, 0x5cfdedf4UL, 0xb9fbdbe8UL, 0xa886b191UL,
-    0x8a7c6563UL, 0xcf89cc87UL, 0x44629f4fUL, 0x88c53e9eUL, 0xcafb7b7dUL,
-    0x4e87f0bbUL, 0x9d0fe176UL, 0xe16ec4adUL, 0x19ac8f1bUL, 0x33591e36UL,
-    0x66b23c6cUL, 0xcd6478d8UL, 0x41b9f7f1UL, 0x8373efe2UL, 0xdd96d985UL,
-    0x605cb54bUL, 0xc0b96a96UL, 0x5a03d36dUL, 0xb407a6daUL, 0xb37e4bf5UL,
-    0xbd8d91abUL, 0xa06a2517UL
-  },
-  {
-    0xf1da05aaUL, 0x38c50d15UL, 0x718a1a2aUL, 0xe3143454UL, 0x1d596ee9UL,
-    0x3ab2ddd2UL, 0x7565bba4UL, 0xeacb7748UL, 0x0ee7e8d1UL, 0x1dcfd1a2UL,
-    0x3b9fa344UL, 0x773f4688UL, 0xee7e8d10UL, 0x078c1c61UL, 0x0f1838c2UL,
-    0x1e307184UL, 0x3c60e308UL, 0x78c1c610UL, 0xf1838c20UL, 0x38761e01UL,
-    0x70ec3c02UL, 0xe1d87804UL, 0x18c1f649UL, 0x3183ec92UL, 0x6307d924UL,
-    0xc60fb248UL, 0x576e62d1UL, 0xaedcc5a2UL, 0x86c88d05UL, 0xd6e01c4bUL,
-    0x76b13ed7UL, 0xed627daeUL
-  },
-  {
-    0x8f352d95UL, 0xc51b5d6bUL, 0x5147bc97UL, 0xa28f792eUL, 0x9e6ff41dUL,
-    0xe7aeee7bUL, 0x142cdab7UL, 0x2859b56eUL, 0x50b36adcUL, 0xa166d5b8UL,
-    0x99bcad31UL, 0xe8085c23UL, 0x0b61be07UL, 0x16c37c0eUL, 0x2d86f81cUL,
-    0x5b0df038UL, 0xb61be070UL, 0xb746c6a1UL, 0xb5fc8b03UL, 0xb0881047UL,
-    0xba6126cfUL, 0xafb34bdfUL, 0x841791ffUL, 0xd35e25bfUL, 0x7dcd4d3fUL,
-    0xfb9a9a7eUL, 0x2c4432bdUL, 0x5888657aUL, 0xb110caf4UL, 0xb95093a9UL,
-    0xa9d02113UL, 0x88d14467UL
-  },
-  {
-    0x33fff533UL, 0x67ffea66UL, 0xcfffd4ccUL, 0x448eafd9UL, 0x891d5fb2UL,
-    0xc94bb925UL, 0x49e6740bUL, 0x93cce816UL, 0xfce8d66dUL, 0x22a0aa9bUL,
-    0x45415536UL, 0x8a82aa6cUL, 0xce745299UL, 0x4799a373UL, 0x8f3346e6UL,
-    0xc5178b8dUL, 0x515e115bUL, 0xa2bc22b6UL, 0x9e09432dUL, 0xe763801bUL,
-    0x15b60677UL, 0x2b6c0ceeUL, 0x56d819dcUL, 0xadb033b8UL, 0x80116131UL,
-    0xdb53c423UL, 0x6dd68e07UL, 0xdbad1c0eUL, 0x6c2b3e5dUL, 0xd8567cbaUL,
-    0x6bddff35UL, 0xd7bbfe6aUL
-  },
-  {
-    0xce3371cbUL, 0x4717e5d7UL, 0x8e2fcbaeUL, 0xc72e911dUL, 0x552c247bUL,
-    0xaa5848f6UL, 0x8fc197adUL, 0xc4f2291bUL, 0x52955477UL, 0xa52aa8eeUL,
-    0x9124579dUL, 0xf939a97bUL, 0x290254b7UL, 0x5204a96eUL, 0xa40952dcUL,
-    0x9363a3f9UL, 0xfdb641b3UL, 0x201d8527UL, 0x403b0a4eUL, 0x8076149cUL,
-    0xdb9d2f79UL, 0x6c4b58b3UL, 0xd896b166UL, 0x6a5c648dUL, 0xd4b8c91aUL,
-    0x72009475UL, 0xe40128eaUL, 0x13735795UL, 0x26e6af2aUL, 0x4dcd5e54UL,
-    0x9b9abca8UL, 0xec447f11UL
-  },
-  {
-    0x1072db28UL, 0x20e5b650UL, 0x41cb6ca0UL, 0x8396d940UL, 0xdc5cb4c1UL,
-    0x63c86fc3UL, 0xc790df86UL, 0x5450b94dUL, 0xa8a1729aUL, 0x8a33e375UL,
-    0xcf16c0abUL, 0x455c8717UL, 0x8ab90e2eUL, 0xce031a1dUL, 0x4777327bUL,
-    0x8eee64f6UL, 0xc6adcfadUL, 0x562a991bUL, 0xac553236UL, 0x83db622dUL,
-    0xdcc7c21bUL, 0x62fe8277UL, 0xc5fd04eeUL, 0x508b0f9dUL, 0xa1161f3aUL,
-    0x995d3835UL, 0xe9cb762bUL, 0x08e7ea17UL, 0x11cfd42eUL, 0x239fa85cUL,
-    0x473f50b8UL, 0x8e7ea170UL
-  },
-  {
-    0xf891f16fUL, 0x2a52e49fUL, 0x54a5c93eUL, 0xa94b927cUL, 0x89e622b9UL,
-    0xc8bd4333UL, 0x4a0b8027UL, 0x9417004eUL, 0xf35f06ddUL, 0x3dcf0bfbUL,
-    0x7b9e17f6UL, 0xf73c2fecUL, 0x35095999UL, 0x6a12b332UL, 0xd4256664UL,
-    0x733bca89UL, 0xe6779512UL, 0x179e2c65UL, 0x2f3c58caUL, 0x5e78b194UL,
-    0xbcf16328UL, 0xa293c011UL, 0x9e568663UL, 0xe7dc0a87UL, 0x14c9134fUL,
-    0x2992269eUL, 0x53244d3cUL, 0xa6489a78UL, 0x97e032b1UL, 0xf4b16323UL,
-    0x3213c007UL, 0x6427800eUL
-  },
-  {
-    0x88b6ba63UL, 0xca1c7287UL, 0x4f49e34fUL, 0x9e93c69eUL, 0xe6568b7dUL,
-    0x17dc10bbUL, 0x2fb82176UL, 0x5f7042ecUL, 0xbee085d8UL, 0xa6b00df1UL,
-    0x96111da3UL, 0xf7533d07UL, 0x35d77c4fUL, 0x6baef89eUL, 0xd75df13cUL,
-    0x75cae439UL, 0xeb95c872UL, 0x0c5a96a5UL, 0x18b52d4aUL, 0x316a5a94UL,
-    0x62d4b528UL, 0xc5a96a50UL, 0x5023d2e1UL, 0xa047a5c2UL, 0x9bfe4dc5UL,
-    0xec8d9dcbUL, 0x026a3dd7UL, 0x04d47baeUL, 0x09a8f75cUL, 0x1351eeb8UL,
-    0x26a3dd70UL, 0x4d47bae0UL
-  },
-  {
-    0x5ad8a92cUL, 0xb5b15258UL, 0xb013a2f1UL, 0xbb5643a3UL, 0xaddd8107UL,
-    0x80ca044fUL, 0xdae50edfUL, 0x6ebb1bffUL, 0xdd7637feUL, 0x619d69bdUL,
-    0xc33ad37aUL, 0x5d04a0b5UL, 0xba09416aUL, 0xaf638495UL, 0x85b60f6bUL,
-    0xd01d1897UL, 0x7b4b376fUL, 0xf6966edeUL, 0x365ddbfdUL, 0x6cbbb7faUL,
-    0xd9776ff4UL, 0x699fd9a9UL, 0xd33fb352UL, 0x7d0e60e5UL, 0xfa1cc1caUL,
-    0x2f4885d5UL, 0x5e910baaUL, 0xbd221754UL, 0xa13528e9UL, 0x991b5793UL,
-    0xe947a967UL, 0x09fe548fUL
-  },
-  {
-    0xb566f6e2UL, 0xb1bceb85UL, 0xb808d14bUL, 0xab60a4d7UL, 0x8db04fefUL,
-    0xc011999fUL, 0x5b52357fUL, 0xb6a46afeUL, 0xb639d3bdUL, 0xb702a13bUL,
-    0xb5744437UL, 0xb1998e2fUL, 0xb8421a1fUL, 0xabf5327fUL, 0x8c9b62bfUL,
-    0xc247c33fUL, 0x5ffe803fUL, 0xbffd007eUL, 0xa48b06bdUL, 0x92670b3bUL,
-    0xffbf1037UL, 0x240f262fUL, 0x481e4c5eUL, 0x903c98bcUL, 0xfb083739UL,
-    0x2d616833UL, 0x5ac2d066UL, 0xb585a0ccUL, 0xb07a47d9UL, 0xbb8589f3UL,
-    0xac7a15a7UL, 0x83852d0fUL
-  },
-  {
-    0x9d9129bfUL, 0xe053553fUL, 0x1bd7ac3fUL, 0x37af587eUL, 0x6f5eb0fcUL,
-    0xdebd61f8UL, 0x660bc5b1UL, 0xcc178b62UL, 0x435e1085UL, 0x86bc210aUL,
-    0xd6094455UL, 0x77638eebUL, 0xeec71dd6UL, 0x06ff3dedUL, 0x0dfe7bdaUL,
-    0x1bfcf7b4UL, 0x37f9ef68UL, 0x6ff3ded0UL, 0xdfe7bda0UL, 0x64be7d01UL,
-    0xc97cfa02UL, 0x4988f245UL, 0x9311e48aUL, 0xfd52cf55UL, 0x21d498ebUL,
-    0x43a931d6UL, 0x875263acUL, 0xd5d5c119UL, 0x70da8473UL, 0xe1b508e6UL,
-    0x181b178dUL, 0x30362f1aUL
-  },
-  {
-    0x2ee43a2cUL, 0x5dc87458UL, 0xbb90e8b0UL, 0xac50d721UL, 0x83d0a803UL,
-    0xdcd05647UL, 0x62d1aacfUL, 0xc5a3559eUL, 0x5037ad7dUL, 0xa06f5afaUL,
-    0x9bafb3b5UL, 0xec2e612bUL, 0x032dc417UL, 0x065b882eUL, 0x0cb7105cUL,
-    0x196e20b8UL, 0x32dc4170UL, 0x65b882e0UL, 0xcb7105c0UL, 0x4d930dc1UL,
-    0x9b261b82UL, 0xed3d3145UL, 0x010b64cbUL, 0x0216c996UL, 0x042d932cUL,
-    0x085b2658UL, 0x10b64cb0UL, 0x216c9960UL, 0x42d932c0UL, 0x85b26580UL,
-    0xd015cd41UL, 0x7b5a9cc3UL
-  },
-  {
-    0x1b4511eeUL, 0x368a23dcUL, 0x6d1447b8UL, 0xda288f70UL, 0x6f2018a1UL,
-    0xde403142UL, 0x67f164c5UL, 0xcfe2c98aUL, 0x44b49555UL, 0x89692aaaUL,
-    0xc9a35315UL, 0x4837a06bUL, 0x906f40d6UL, 0xfbaf87edUL, 0x2c2e099bUL,
-    0x585c1336UL, 0xb0b8266cUL, 0xba014a99UL, 0xaf739373UL, 0x859620a7UL,
-    0xd05d470fUL, 0x7bcb885fUL, 0xf79710beUL, 0x345f273dUL, 0x68be4e7aUL,
-    0xd17c9cf4UL, 0x79883fa9UL, 0xf3107f52UL, 0x3d51f8e5UL, 0x7aa3f1caUL,
-    0xf547e394UL, 0x31fec169UL
-  },
-  {
-    0xbce15202UL, 0xa2b3a245UL, 0x9e1642cbUL, 0xe75d83d7UL, 0x15ca01efUL,
-    0x2b9403deUL, 0x572807bcUL, 0xae500f78UL, 0x87d118b1UL, 0xd4d33723UL,
-    0x72d76807UL, 0xe5aed00eUL, 0x102ca65dUL, 0x20594cbaUL, 0x40b29974UL,
-    0x816532e8UL, 0xd9bb6391UL, 0x6807c163UL, 0xd00f82c6UL, 0x7b6e03cdUL,
-    0xf6dc079aUL, 0x36c90975UL, 0x6d9212eaUL, 0xdb2425d4UL, 0x6d394de9UL,
-    0xda729bd2UL, 0x6f9431e5UL, 0xdf2863caUL, 0x6521c1d5UL, 0xca4383aaUL,
-    0x4ff60115UL, 0x9fec022aUL
-  },
-  {
-    0xff08e5efUL, 0x2560cd9fUL, 0x4ac19b3eUL, 0x9583367cUL, 0xf0776ab9UL,
-    0x3b9fd333UL, 0x773fa666UL, 0xee7f4cccUL, 0x078f9fd9UL, 0x0f1f3fb2UL,
-    0x1e3e7f64UL, 0x3c7cfec8UL, 0x78f9fd90UL, 0xf1f3fb20UL, 0x3896f001UL,
-    0x712de002UL, 0xe25bc004UL, 0x1fc68649UL, 0x3f8d0c92UL, 0x7f1a1924UL,
-    0xfe343248UL, 0x271962d1UL, 0x4e32c5a2UL, 0x9c658b44UL, 0xe3ba10c9UL,
-    0x1c0527d3UL, 0x380a4fa6UL, 0x70149f4cUL, 0xe0293e98UL, 0x1b237b71UL,
-    0x3646f6e2UL, 0x6c8dedc4UL
-  },
-  {
-    0x6f76172eUL, 0xdeec2e5cUL, 0x66a95af9UL, 0xcd52b5f2UL, 0x41d46da5UL,
-    0x83a8db4aUL, 0xdc20b0d5UL, 0x633067ebUL, 0xc660cfd6UL, 0x57b099edUL,
-    0xaf6133daUL, 0x85b361f5UL, 0xd017c5abUL, 0x7b5e8d17UL, 0xf6bd1a2eUL,
-    0x360b321dUL, 0x6c16643aUL, 0xd82cc874UL, 0x6b2896a9UL, 0xd6512d52UL,
-    0x77d35ce5UL, 0xefa6b9caUL, 0x043c75d5UL, 0x0878ebaaUL, 0x10f1d754UL,
-    0x21e3aea8UL, 0x43c75d50UL, 0x878ebaa0UL, 0xd46c7301UL, 0x73a9e043UL,
-    0xe753c086UL, 0x15d6874dUL
-  },
-  {
-    0x56f5cab9UL, 0xadeb9572UL, 0x80a62ca5UL, 0xda3d5f0bUL, 0x6f0bb857UL,
-    0xde1770aeUL, 0x675fe71dUL, 0xcebfce3aUL, 0x460e9a35UL, 0x8c1d346aUL,
-    0xc34b6e95UL, 0x5de7db6bUL, 0xbbcfb6d6UL, 0xacee6bedUL, 0x82add19bUL,
-    0xde2aa577UL, 0x67244cafUL, 0xce48995eUL, 0x47e034fdUL, 0x8fc069faUL,
-    0xc4f1d5b5UL, 0x5292ad2bUL, 0xa5255a56UL, 0x913bb2edUL, 0xf906639bUL,
-    0x297dc177UL, 0x52fb82eeUL, 0xa5f705dcUL, 0x909f0df9UL, 0xfa4f1db3UL,
-    0x2fef3d27UL, 0x5fde7a4eUL
-  },
-  {
-    0x385993acUL, 0x70b32758UL, 0xe1664eb0UL, 0x19bd9b21UL, 0x337b3642UL,
-    0x66f66c84UL, 0xcdecd908UL, 0x40a8b451UL, 0x815168a2UL, 0xd9d3d705UL,
-    0x68d6a84bUL, 0xd1ad5096UL, 0x782ba76dUL, 0xf0574edaUL, 0x3bdf9bf5UL,
-    0x77bf37eaUL, 0xef7e6fd4UL, 0x058dd9e9UL, 0x0b1bb3d2UL, 0x163767a4UL,
-    0x2c6ecf48UL, 0x58dd9e90UL, 0xb1bb3d20UL, 0xb8077c01UL, 0xab7ffe43UL,
-    0x8d8efac7UL, 0xc06cf3cfUL, 0x5ba8e1dfUL, 0xb751c3beUL, 0xb5d2813dUL,
-    0xb0d4043bUL, 0xbad90e37UL
-  },
-  {
-    0xb4247b20UL, 0xb339f001UL, 0xbd02e643UL, 0xa174cac7UL, 0x999893cfUL,
-    0xe84021dfUL, 0x0bf145ffUL, 0x17e28bfeUL, 0x2fc517fcUL, 0x5f8a2ff8UL,
-    0xbf145ff0UL, 0xa559b9a1UL, 0x91c27503UL, 0xf8f5ec47UL, 0x2a9adecfUL,
-    0x5535bd9eUL, 0xaa6b7b3cUL, 0x8fa7f039UL, 0xc43ee633UL, 0x530cca27UL,
-    0xa619944eUL, 0x97422eddUL, 0xf5f55bfbUL, 0x309bb1b7UL, 0x6137636eUL,
-    0xc26ec6dcUL, 0x5fac8bf9UL, 0xbf5917f2UL, 0xa5c329a5UL, 0x90f7550bUL,
-    0xfa9fac57UL, 0x2e4e5eefUL
-  },
-  {
-    0x695186a7UL, 0xd2a30d4eUL, 0x7e371cddUL, 0xfc6e39baUL, 0x23ad7535UL,
-    0x475aea6aUL, 0x8eb5d4d4UL, 0xc61aafe9UL, 0x57445993UL, 0xae88b326UL,
-    0x8660600dUL, 0xd7b1c65bUL, 0x74128af7UL, 0xe82515eeUL, 0x0b3b2d9dUL,
-    0x16765b3aUL, 0x2cecb674UL, 0x59d96ce8UL, 0xb3b2d9d0UL, 0xbc14b5e1UL,
-    0xa3586d83UL, 0x9dc1dd47UL, 0xe0f2bccfUL, 0x1a947fdfUL, 0x3528ffbeUL,
-    0x6a51ff7cUL, 0xd4a3fef8UL, 0x7236fbb1UL, 0xe46df762UL, 0x13aae885UL,
-    0x2755d10aUL, 0x4eaba214UL
-  },
-  {
-    0x66bc001eUL, 0xcd78003cUL, 0x41810639UL, 0x83020c72UL, 0xdd751ea5UL,
-    0x619b3b0bUL, 0xc3367616UL, 0x5d1dea6dUL, 0xba3bd4daUL, 0xaf06aff5UL,
-    0x857c59abUL, 0xd189b517UL, 0x78626c6fUL, 0xf0c4d8deUL, 0x3af8b7fdUL,
-    0x75f16ffaUL, 0xebe2dff4UL, 0x0cb4b9a9UL, 0x19697352UL, 0x32d2e6a4UL,
-    0x65a5cd48UL, 0xcb4b9a90UL, 0x4de63361UL, 0x9bcc66c2UL, 0xece9cbc5UL,
-    0x02a291cbUL, 0x05452396UL, 0x0a8a472cUL, 0x15148e58UL, 0x2a291cb0UL,
-    0x54523960UL, 0xa8a472c0UL
-  },
-  {
-    0xb58b27b3UL, 0xb0674927UL, 0xbbbf940fUL, 0xac0e2e5fUL, 0x836d5affUL,
-    0xddabb3bfUL, 0x6026613fUL, 0xc04cc27eUL, 0x5be882bdUL, 0xb7d1057aUL,
-    0xb4d30cb5UL, 0xb2d71f2bUL, 0xbedf3817UL, 0xa6cf766fUL, 0x96efea9fUL,
-    0xf6aed37fUL, 0x362ca0bfUL, 0x6c59417eUL, 0xd8b282fcUL, 0x6a1403b9UL,
-    0xd4280772UL, 0x732108a5UL, 0xe642114aUL, 0x17f524d5UL, 0x2fea49aaUL,
-    0x5fd49354UL, 0xbfa926a8UL, 0xa4234b11UL, 0x93379063UL, 0xfd1e2687UL,
-    0x214d4b4fUL, 0x429a969eUL
-  },
-  {
-    0xfe273162UL, 0x273f6485UL, 0x4e7ec90aUL, 0x9cfd9214UL, 0xe28a2269UL,
-    0x1e654293UL, 0x3cca8526UL, 0x79950a4cUL, 0xf32a1498UL, 0x3d252f71UL,
-    0x7a4a5ee2UL, 0xf494bdc4UL, 0x32587dc9UL, 0x64b0fb92UL, 0xc961f724UL,
-    0x49b2e809UL, 0x9365d012UL, 0xfdbaa665UL, 0x20044a8bUL, 0x40089516UL,
-    0x80112a2cUL, 0xdb535219UL, 0x6dd7a273UL, 0xdbaf44e6UL, 0x6c2f8f8dUL,
-    0xd85f1f1aUL, 0x6bcf3875UL, 0xd79e70eaUL, 0x744de795UL, 0xe89bcf2aUL,
-    0x0a469815UL, 0x148d302aUL
-  },
-  {
-    0xd3c98813UL, 0x7ce21667UL, 0xf9c42cceUL, 0x28f95fddUL, 0x51f2bfbaUL,
-    0xa3e57f74UL, 0x9cbbf8a9UL, 0xe206f713UL, 0x1f7ce867UL, 0x3ef9d0ceUL,
-    0x7df3a19cUL, 0xfbe74338UL, 0x2cbf8031UL, 0x597f0062UL, 0xb2fe00c4UL,
-    0xbe8d07c9UL, 0xa66b09d3UL, 0x97a715e7UL, 0xf43f2d8fUL, 0x330f5d5fUL,
-    0x661ebabeUL, 0xcc3d757cUL, 0x430becb9UL, 0x8617d972UL, 0xd75eb4a5UL,
-    0x75cc6f0bUL, 0xeb98de16UL, 0x0c40ba6dUL, 0x188174daUL, 0x3102e9b4UL,
-    0x6205d368UL, 0xc40ba6d0UL
-  },
-  {
-    0xf7d6deb4UL, 0x34dcbb29UL, 0x69b97652UL, 0xd372eca4UL, 0x7d94df09UL,
-    0xfb29be12UL, 0x2d227a65UL, 0x5a44f4caUL, 0xb489e994UL, 0xb262d569UL,
-    0xbfb4ac93UL, 0xa4185f67UL, 0x9341b88fUL, 0xfdf2775fUL, 0x2095e8ffUL,
-    0x412bd1feUL, 0x8257a3fcUL, 0xdfde41b9UL, 0x64cd8533UL, 0xc99b0a66UL,
-    0x4847128dUL, 0x908e251aUL, 0xfa6d4c75UL, 0x2fab9eabUL, 0x5f573d56UL,
-    0xbeae7aacUL, 0xa62df319UL, 0x972ae073UL, 0xf524c6a7UL, 0x31388b0fUL,
-    0x6271161eUL, 0xc4e22c3cUL
-  },
-  {
-    0xedb88320UL, 0x00000001UL, 0x00000002UL, 0x00000004UL, 0x00000008UL,
-    0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL, 0x00000100UL,
-    0x00000200UL, 0x00000400UL, 0x00000800UL, 0x00001000UL, 0x00002000UL,
-    0x00004000UL, 0x00008000UL, 0x00010000UL, 0x00020000UL, 0x00040000UL,
-    0x00080000UL, 0x00100000UL, 0x00200000UL, 0x00400000UL, 0x00800000UL,
-    0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL, 0x10000000UL,
-    0x20000000UL, 0x40000000UL
-  },
-  {
-    0x76dc4190UL, 0xedb88320UL, 0x00000001UL, 0x00000002UL, 0x00000004UL,
-    0x00000008UL, 0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL,
-    0x00000100UL, 0x00000200UL, 0x00000400UL, 0x00000800UL, 0x00001000UL,
-    0x00002000UL, 0x00004000UL, 0x00008000UL, 0x00010000UL, 0x00020000UL,
-    0x00040000UL, 0x00080000UL, 0x00100000UL, 0x00200000UL, 0x00400000UL,
-    0x00800000UL, 0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL,
-    0x10000000UL, 0x20000000UL
-  },
-  {
-    0x1db71064UL, 0x3b6e20c8UL, 0x76dc4190UL, 0xedb88320UL, 0x00000001UL,
-    0x00000002UL, 0x00000004UL, 0x00000008UL, 0x00000010UL, 0x00000020UL,
-    0x00000040UL, 0x00000080UL, 0x00000100UL, 0x00000200UL, 0x00000400UL,
-    0x00000800UL, 0x00001000UL, 0x00002000UL, 0x00004000UL, 0x00008000UL,
-    0x00010000UL, 0x00020000UL, 0x00040000UL, 0x00080000UL, 0x00100000UL,
-    0x00200000UL, 0x00400000UL, 0x00800000UL, 0x01000000UL, 0x02000000UL,
-    0x04000000UL, 0x08000000UL
+    0x77073096, 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064,
+    0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002,
+    0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040,
+    0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800,
+    0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000,
+    0x00020000, 0x00040000, 0x00080000, 0x00100000, 0x00200000,
+    0x00400000, 0x00800000
+  },
+  {
+    0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, 0x4ac21251,
+    0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, 0xee0e612c,
+    0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, 0x76dc4190,
+    0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+    0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100,
+    0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000,
+    0x00004000, 0x00008000
+  },
+  {
+    0xb8bc6765, 0xaa09c88b, 0x8f629757, 0xc5b428ef, 0x5019579f,
+    0xa032af3e, 0x9b14583d, 0xed59b63b, 0x01c26a37, 0x0384d46e,
+    0x0709a8dc, 0x0e1351b8, 0x1c26a370, 0x384d46e0, 0x709a8dc0,
+    0xe1351b80, 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08,
+    0x4ac21251, 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096,
+    0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8,
+    0x76dc4190, 0xedb88320
+  },
+  {
+    0xccaa009e, 0x4225077d, 0x844a0efa, 0xd3e51bb5, 0x7cbb312b,
+    0xf9766256, 0x299dc2ed, 0x533b85da, 0xa6770bb4, 0x979f1129,
+    0xf44f2413, 0x33ef4e67, 0x67de9cce, 0xcfbd399c, 0x440b7579,
+    0x8816eaf2, 0xcb5cd3a5, 0x4dc8a10b, 0x9b914216, 0xec53826d,
+    0x03d6029b, 0x07ac0536, 0x0f580a6c, 0x1eb014d8, 0x3d6029b0,
+    0x7ac05360, 0xf580a6c0, 0x30704bc1, 0x60e09782, 0xc1c12f04,
+    0x58f35849, 0xb1e6b092
+  },
+  {
+    0xae689191, 0x87a02563, 0xd4314c87, 0x73139f4f, 0xe6273e9e,
+    0x173f7b7d, 0x2e7ef6fa, 0x5cfdedf4, 0xb9fbdbe8, 0xa886b191,
+    0x8a7c6563, 0xcf89cc87, 0x44629f4f, 0x88c53e9e, 0xcafb7b7d,
+    0x4e87f0bb, 0x9d0fe176, 0xe16ec4ad, 0x19ac8f1b, 0x33591e36,
+    0x66b23c6c, 0xcd6478d8, 0x41b9f7f1, 0x8373efe2, 0xdd96d985,
+    0x605cb54b, 0xc0b96a96, 0x5a03d36d, 0xb407a6da, 0xb37e4bf5,
+    0xbd8d91ab, 0xa06a2517
+  },
+  {
+    0xf1da05aa, 0x38c50d15, 0x718a1a2a, 0xe3143454, 0x1d596ee9,
+    0x3ab2ddd2, 0x7565bba4, 0xeacb7748, 0x0ee7e8d1, 0x1dcfd1a2,
+    0x3b9fa344, 0x773f4688, 0xee7e8d10, 0x078c1c61, 0x0f1838c2,
+    0x1e307184, 0x3c60e308, 0x78c1c610, 0xf1838c20, 0x38761e01,
+    0x70ec3c02, 0xe1d87804, 0x18c1f649, 0x3183ec92, 0x6307d924,
+    0xc60fb248, 0x576e62d1, 0xaedcc5a2, 0x86c88d05, 0xd6e01c4b,
+    0x76b13ed7, 0xed627dae
+  },
+  {
+    0x8f352d95, 0xc51b5d6b, 0x5147bc97, 0xa28f792e, 0x9e6ff41d,
+    0xe7aeee7b, 0x142cdab7, 0x2859b56e, 0x50b36adc, 0xa166d5b8,
+    0x99bcad31, 0xe8085c23, 0x0b61be07, 0x16c37c0e, 0x2d86f81c,
+    0x5b0df038, 0xb61be070, 0xb746c6a1, 0xb5fc8b03, 0xb0881047,
+    0xba6126cf, 0xafb34bdf, 0x841791ff, 0xd35e25bf, 0x7dcd4d3f,
+    0xfb9a9a7e, 0x2c4432bd, 0x5888657a, 0xb110caf4, 0xb95093a9,
+    0xa9d02113, 0x88d14467
+  },
+  {
+    0x33fff533, 0x67ffea66, 0xcfffd4cc, 0x448eafd9, 0x891d5fb2,
+    0xc94bb925, 0x49e6740b, 0x93cce816, 0xfce8d66d, 0x22a0aa9b,
+    0x45415536, 0x8a82aa6c, 0xce745299, 0x4799a373, 0x8f3346e6,
+    0xc5178b8d, 0x515e115b, 0xa2bc22b6, 0x9e09432d, 0xe763801b,
+    0x15b60677, 0x2b6c0cee, 0x56d819dc, 0xadb033b8, 0x80116131,
+    0xdb53c423, 0x6dd68e07, 0xdbad1c0e, 0x6c2b3e5d, 0xd8567cba,
+    0x6bddff35, 0xd7bbfe6a
+  },
+  {
+    0xce3371cb, 0x4717e5d7, 0x8e2fcbae, 0xc72e911d, 0x552c247b,
+    0xaa5848f6, 0x8fc197ad, 0xc4f2291b, 0x52955477, 0xa52aa8ee,
+    0x9124579d, 0xf939a97b, 0x290254b7, 0x5204a96e, 0xa40952dc,
+    0x9363a3f9, 0xfdb641b3, 0x201d8527, 0x403b0a4e, 0x8076149c,
+    0xdb9d2f79, 0x6c4b58b3, 0xd896b166, 0x6a5c648d, 0xd4b8c91a,
+    0x72009475, 0xe40128ea, 0x13735795, 0x26e6af2a, 0x4dcd5e54,
+    0x9b9abca8, 0xec447f11
+  },
+  {
+    0x1072db28, 0x20e5b650, 0x41cb6ca0, 0x8396d940, 0xdc5cb4c1,
+    0x63c86fc3, 0xc790df86, 0x5450b94d, 0xa8a1729a, 0x8a33e375,
+    0xcf16c0ab, 0x455c8717, 0x8ab90e2e, 0xce031a1d, 0x4777327b,
+    0x8eee64f6, 0xc6adcfad, 0x562a991b, 0xac553236, 0x83db622d,
+    0xdcc7c21b, 0x62fe8277, 0xc5fd04ee, 0x508b0f9d, 0xa1161f3a,
+    0x995d3835, 0xe9cb762b, 0x08e7ea17, 0x11cfd42e, 0x239fa85c,
+    0x473f50b8, 0x8e7ea170
+  },
+  {
+    0xf891f16f, 0x2a52e49f, 0x54a5c93e, 0xa94b927c, 0x89e622b9,
+    0xc8bd4333, 0x4a0b8027, 0x9417004e, 0xf35f06dd, 0x3dcf0bfb,
+    0x7b9e17f6, 0xf73c2fec, 0x35095999, 0x6a12b332, 0xd4256664,
+    0x733bca89, 0xe6779512, 0x179e2c65, 0x2f3c58ca, 0x5e78b194,
+    0xbcf16328, 0xa293c011, 0x9e568663, 0xe7dc0a87, 0x14c9134f,
+    0x2992269e, 0x53244d3c, 0xa6489a78, 0x97e032b1, 0xf4b16323,
+    0x3213c007, 0x6427800e
+  },
+  {
+    0x88b6ba63, 0xca1c7287, 0x4f49e34f, 0x9e93c69e, 0xe6568b7d,
+    0x17dc10bb, 0x2fb82176, 0x5f7042ec, 0xbee085d8, 0xa6b00df1,
+    0x96111da3, 0xf7533d07, 0x35d77c4f, 0x6baef89e, 0xd75df13c,
+    0x75cae439, 0xeb95c872, 0x0c5a96a5, 0x18b52d4a, 0x316a5a94,
+    0x62d4b528, 0xc5a96a50, 0x5023d2e1, 0xa047a5c2, 0x9bfe4dc5,
+    0xec8d9dcb, 0x026a3dd7, 0x04d47bae, 0x09a8f75c, 0x1351eeb8,
+    0x26a3dd70, 0x4d47bae0
+  },
+  {
+    0x5ad8a92c, 0xb5b15258, 0xb013a2f1, 0xbb5643a3, 0xaddd8107,
+    0x80ca044f, 0xdae50edf, 0x6ebb1bff, 0xdd7637fe, 0x619d69bd,
+    0xc33ad37a, 0x5d04a0b5, 0xba09416a, 0xaf638495, 0x85b60f6b,
+    0xd01d1897, 0x7b4b376f, 0xf6966ede, 0x365ddbfd, 0x6cbbb7fa,
+    0xd9776ff4, 0x699fd9a9, 0xd33fb352, 0x7d0e60e5, 0xfa1cc1ca,
+    0x2f4885d5, 0x5e910baa, 0xbd221754, 0xa13528e9, 0x991b5793,
+    0xe947a967, 0x09fe548f
+  },
+  {
+    0xb566f6e2, 0xb1bceb85, 0xb808d14b, 0xab60a4d7, 0x8db04fef,
+    0xc011999f, 0x5b52357f, 0xb6a46afe, 0xb639d3bd, 0xb702a13b,
+    0xb5744437, 0xb1998e2f, 0xb8421a1f, 0xabf5327f, 0x8c9b62bf,
+    0xc247c33f, 0x5ffe803f, 0xbffd007e, 0xa48b06bd, 0x92670b3b,
+    0xffbf1037, 0x240f262f, 0x481e4c5e, 0x903c98bc, 0xfb083739,
+    0x2d616833, 0x5ac2d066, 0xb585a0cc, 0xb07a47d9, 0xbb8589f3,
+    0xac7a15a7, 0x83852d0f
+  },
+  {
+    0x9d9129bf, 0xe053553f, 0x1bd7ac3f, 0x37af587e, 0x6f5eb0fc,
+    0xdebd61f8, 0x660bc5b1, 0xcc178b62, 0x435e1085, 0x86bc210a,
+    0xd6094455, 0x77638eeb, 0xeec71dd6, 0x06ff3ded, 0x0dfe7bda,
+    0x1bfcf7b4, 0x37f9ef68, 0x6ff3ded0, 0xdfe7bda0, 0x64be7d01,
+    0xc97cfa02, 0x4988f245, 0x9311e48a, 0xfd52cf55, 0x21d498eb,
+    0x43a931d6, 0x875263ac, 0xd5d5c119, 0x70da8473, 0xe1b508e6,
+    0x181b178d, 0x30362f1a
+  },
+  {
+    0x2ee43a2c, 0x5dc87458, 0xbb90e8b0, 0xac50d721, 0x83d0a803,
+    0xdcd05647, 0x62d1aacf, 0xc5a3559e, 0x5037ad7d, 0xa06f5afa,
+    0x9bafb3b5, 0xec2e612b, 0x032dc417, 0x065b882e, 0x0cb7105c,
+    0x196e20b8, 0x32dc4170, 0x65b882e0, 0xcb7105c0, 0x4d930dc1,
+    0x9b261b82, 0xed3d3145, 0x010b64cb, 0x0216c996, 0x042d932c,
+    0x085b2658, 0x10b64cb0, 0x216c9960, 0x42d932c0, 0x85b26580,
+    0xd015cd41, 0x7b5a9cc3
+  },
+  {
+    0x1b4511ee, 0x368a23dc, 0x6d1447b8, 0xda288f70, 0x6f2018a1,
+    0xde403142, 0x67f164c5, 0xcfe2c98a, 0x44b49555, 0x89692aaa,
+    0xc9a35315, 0x4837a06b, 0x906f40d6, 0xfbaf87ed, 0x2c2e099b,
+    0x585c1336, 0xb0b8266c, 0xba014a99, 0xaf739373, 0x859620a7,
+    0xd05d470f, 0x7bcb885f, 0xf79710be, 0x345f273d, 0x68be4e7a,
+    0xd17c9cf4, 0x79883fa9, 0xf3107f52, 0x3d51f8e5, 0x7aa3f1ca,
+    0xf547e394, 0x31fec169
+  },
+  {
+    0xbce15202, 0xa2b3a245, 0x9e1642cb, 0xe75d83d7, 0x15ca01ef,
+    0x2b9403de, 0x572807bc, 0xae500f78, 0x87d118b1, 0xd4d33723,
+    0x72d76807, 0xe5aed00e, 0x102ca65d, 0x20594cba, 0x40b29974,
+    0x816532e8, 0xd9bb6391, 0x6807c163, 0xd00f82c6, 0x7b6e03cd,
+    0xf6dc079a, 0x36c90975, 0x6d9212ea, 0xdb2425d4, 0x6d394de9,
+    0xda729bd2, 0x6f9431e5, 0xdf2863ca, 0x6521c1d5, 0xca4383aa,
+    0x4ff60115, 0x9fec022a
+  },
+  {
+    0xff08e5ef, 0x2560cd9f, 0x4ac19b3e, 0x9583367c, 0xf0776ab9,
+    0x3b9fd333, 0x773fa666, 0xee7f4ccc, 0x078f9fd9, 0x0f1f3fb2,
+    0x1e3e7f64, 0x3c7cfec8, 0x78f9fd90, 0xf1f3fb20, 0x3896f001,
+    0x712de002, 0xe25bc004, 0x1fc68649, 0x3f8d0c92, 0x7f1a1924,
+    0xfe343248, 0x271962d1, 0x4e32c5a2, 0x9c658b44, 0xe3ba10c9,
+    0x1c0527d3, 0x380a4fa6, 0x70149f4c, 0xe0293e98, 0x1b237b71,
+    0x3646f6e2, 0x6c8dedc4
+  },
+  {
+    0x6f76172e, 0xdeec2e5c, 0x66a95af9, 0xcd52b5f2, 0x41d46da5,
+    0x83a8db4a, 0xdc20b0d5, 0x633067eb, 0xc660cfd6, 0x57b099ed,
+    0xaf6133da, 0x85b361f5, 0xd017c5ab, 0x7b5e8d17, 0xf6bd1a2e,
+    0x360b321d, 0x6c16643a, 0xd82cc874, 0x6b2896a9, 0xd6512d52,
+    0x77d35ce5, 0xefa6b9ca, 0x043c75d5, 0x0878ebaa, 0x10f1d754,
+    0x21e3aea8, 0x43c75d50, 0x878ebaa0, 0xd46c7301, 0x73a9e043,
+    0xe753c086, 0x15d6874d
+  },
+  {
+    0x56f5cab9, 0xadeb9572, 0x80a62ca5, 0xda3d5f0b, 0x6f0bb857,
+    0xde1770ae, 0x675fe71d, 0xcebfce3a, 0x460e9a35, 0x8c1d346a,
+    0xc34b6e95, 0x5de7db6b, 0xbbcfb6d6, 0xacee6bed, 0x82add19b,
+    0xde2aa577, 0x67244caf, 0xce48995e, 0x47e034fd, 0x8fc069fa,
+    0xc4f1d5b5, 0x5292ad2b, 0xa5255a56, 0x913bb2ed, 0xf906639b,
+    0x297dc177, 0x52fb82ee, 0xa5f705dc, 0x909f0df9, 0xfa4f1db3,
+    0x2fef3d27, 0x5fde7a4e
+  },
+  {
+    0x385993ac, 0x70b32758, 0xe1664eb0, 0x19bd9b21, 0x337b3642,
+    0x66f66c84, 0xcdecd908, 0x40a8b451, 0x815168a2, 0xd9d3d705,
+    0x68d6a84b, 0xd1ad5096, 0x782ba76d, 0xf0574eda, 0x3bdf9bf5,
+    0x77bf37ea, 0xef7e6fd4, 0x058dd9e9, 0x0b1bb3d2, 0x163767a4,
+    0x2c6ecf48, 0x58dd9e90, 0xb1bb3d20, 0xb8077c01, 0xab7ffe43,
+    0x8d8efac7, 0xc06cf3cf, 0x5ba8e1df, 0xb751c3be, 0xb5d2813d,
+    0xb0d4043b, 0xbad90e37
+  },
+  {
+    0xb4247b20, 0xb339f001, 0xbd02e643, 0xa174cac7, 0x999893cf,
+    0xe84021df, 0x0bf145ff, 0x17e28bfe, 0x2fc517fc, 0x5f8a2ff8,
+    0xbf145ff0, 0xa559b9a1, 0x91c27503, 0xf8f5ec47, 0x2a9adecf,
+    0x5535bd9e, 0xaa6b7b3c, 0x8fa7f039, 0xc43ee633, 0x530cca27,
+    0xa619944e, 0x97422edd, 0xf5f55bfb, 0x309bb1b7, 0x6137636e,
+    0xc26ec6dc, 0x5fac8bf9, 0xbf5917f2, 0xa5c329a5, 0x90f7550b,
+    0xfa9fac57, 0x2e4e5eef
+  },
+  {
+    0x695186a7, 0xd2a30d4e, 0x7e371cdd, 0xfc6e39ba, 0x23ad7535,
+    0x475aea6a, 0x8eb5d4d4, 0xc61aafe9, 0x57445993, 0xae88b326,
+    0x8660600d, 0xd7b1c65b, 0x74128af7, 0xe82515ee, 0x0b3b2d9d,
+    0x16765b3a, 0x2cecb674, 0x59d96ce8, 0xb3b2d9d0, 0xbc14b5e1,
+    0xa3586d83, 0x9dc1dd47, 0xe0f2bccf, 0x1a947fdf, 0x3528ffbe,
+    0x6a51ff7c, 0xd4a3fef8, 0x7236fbb1, 0xe46df762, 0x13aae885,
+    0x2755d10a, 0x4eaba214
+  },
+  {
+    0x66bc001e, 0xcd78003c, 0x41810639, 0x83020c72, 0xdd751ea5,
+    0x619b3b0b, 0xc3367616, 0x5d1dea6d, 0xba3bd4da, 0xaf06aff5,
+    0x857c59ab, 0xd189b517, 0x78626c6f, 0xf0c4d8de, 0x3af8b7fd,
+    0x75f16ffa, 0xebe2dff4, 0x0cb4b9a9, 0x19697352, 0x32d2e6a4,
+    0x65a5cd48, 0xcb4b9a90, 0x4de63361, 0x9bcc66c2, 0xece9cbc5,
+    0x02a291cb, 0x05452396, 0x0a8a472c, 0x15148e58, 0x2a291cb0,
+    0x54523960, 0xa8a472c0
+  },
+  {
+    0xb58b27b3, 0xb0674927, 0xbbbf940f, 0xac0e2e5f, 0x836d5aff,
+    0xddabb3bf, 0x6026613f, 0xc04cc27e, 0x5be882bd, 0xb7d1057a,
+    0xb4d30cb5, 0xb2d71f2b, 0xbedf3817, 0xa6cf766f, 0x96efea9f,
+    0xf6aed37f, 0x362ca0bf, 0x6c59417e, 0xd8b282fc, 0x6a1403b9,
+    0xd4280772, 0x732108a5, 0xe642114a, 0x17f524d5, 0x2fea49aa,
+    0x5fd49354, 0xbfa926a8, 0xa4234b11, 0x93379063, 0xfd1e2687,
+    0x214d4b4f, 0x429a969e
+  },
+  {
+    0xfe273162, 0x273f6485, 0x4e7ec90a, 0x9cfd9214, 0xe28a2269,
+    0x1e654293, 0x3cca8526, 0x79950a4c, 0xf32a1498, 0x3d252f71,
+    0x7a4a5ee2, 0xf494bdc4, 0x32587dc9, 0x64b0fb92, 0xc961f724,
+    0x49b2e809, 0x9365d012, 0xfdbaa665, 0x20044a8b, 0x40089516,
+    0x80112a2c, 0xdb535219, 0x6dd7a273, 0xdbaf44e6, 0x6c2f8f8d,
+    0xd85f1f1a, 0x6bcf3875, 0xd79e70ea, 0x744de795, 0xe89bcf2a,
+    0x0a469815, 0x148d302a
+  },
+  {
+    0xd3c98813, 0x7ce21667, 0xf9c42cce, 0x28f95fdd, 0x51f2bfba,
+    0xa3e57f74, 0x9cbbf8a9, 0xe206f713, 0x1f7ce867, 0x3ef9d0ce,
+    0x7df3a19c, 0xfbe74338, 0x2cbf8031, 0x597f0062, 0xb2fe00c4,
+    0xbe8d07c9, 0xa66b09d3, 0x97a715e7, 0xf43f2d8f, 0x330f5d5f,
+    0x661ebabe, 0xcc3d757c, 0x430becb9, 0x8617d972, 0xd75eb4a5,
+    0x75cc6f0b, 0xeb98de16, 0x0c40ba6d, 0x188174da, 0x3102e9b4,
+    0x6205d368, 0xc40ba6d0
+  },
+  {
+    0xf7d6deb4, 0x34dcbb29, 0x69b97652, 0xd372eca4, 0x7d94df09,
+    0xfb29be12, 0x2d227a65, 0x5a44f4ca, 0xb489e994, 0xb262d569,
+    0xbfb4ac93, 0xa4185f67, 0x9341b88f, 0xfdf2775f, 0x2095e8ff,
+    0x412bd1fe, 0x8257a3fc, 0xdfde41b9, 0x64cd8533, 0xc99b0a66,
+    0x4847128d, 0x908e251a, 0xfa6d4c75, 0x2fab9eab, 0x5f573d56,
+    0xbeae7aac, 0xa62df319, 0x972ae073, 0xf524c6a7, 0x31388b0f,
+    0x6271161e, 0xc4e22c3c
+  },
+  {
+    0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+    0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100,
+    0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000,
+    0x00004000, 0x00008000, 0x00010000, 0x00020000, 0x00040000,
+    0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000,
+    0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
+    0x20000000, 0x40000000
+  },
+  {
+    0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, 0x00000004,
+    0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080,
+    0x00000100, 0x00000200, 0x00000400, 0x00000800, 0x00001000,
+    0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000,
+    0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000,
+    0x00800000, 0x01000000, 0x02000000, 0x04000000, 0x08000000,
+    0x10000000, 0x20000000
+  },
+  {
+    0x1db71064, 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001,
+    0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020,
+    0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400,
+    0x00000800, 0x00001000, 0x00002000, 0x00004000, 0x00008000,
+    0x00010000, 0x00020000, 0x00040000, 0x00080000, 0x00100000,
+    0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x02000000,
+    0x04000000, 0x08000000
   }
 };
 #endif /* CRC32_H_ */
diff --git a/crc32_p.h b/crc32_p.h
new file mode 100644 (file)
index 0000000..47b4b37
--- /dev/null
+++ b/crc32_p.h
@@ -0,0 +1,19 @@
+#ifndef CRC32_P_H_
+#define CRC32_P_H_
+
+#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
+
+
+static inline uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) {
+    uint32_t sum = 0;
+    while (vec) {
+        if (vec & 1)
+            sum ^= *mat;
+        vec >>= 1;
+        mat++;
+    }
+    return sum;
+}
+
+
+#endif /* CRC32_P_H_ */
index c32e55fd351aa33199d56df4e1b58938e36ddfc5..62a5a31f821dc1c1988bc2cd6340fcc9403a03ad 100644 (file)
@@ -1,4 +1,4 @@
-/* crc32.c -- output crc32.h header file
+/* crc32.c -- output crc32 tables
  * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
 */
@@ -6,31 +6,17 @@
 #include <stdio.h>
 #include <inttypes.h>
 #include "zbuild.h"
-#include "zendian.h"
 #include "deflate.h"
+#include "crc32_p.h"
 
-#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
-uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec);
-
-/* ========================================================================= */
-uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) {
-    uint32_t sum = 0;
-    while (vec) {
-        if (vec & 1)
-            sum ^= *mat;
-        vec >>= 1;
-        mat++;
-    }
-    return sum;
-}
-
-
-volatile int crc_table_empty = 1;
 static uint32_t crc_table[8][256];
 static uint32_t crc_comb[GF2_DIM][GF2_DIM];
-void make_crc_table(void);
+
 static void gf2_matrix_square(uint32_t *square, const uint32_t *mat);
-static void write_table(FILE *, const uint32_t *, int);
+static void make_crc_table(void);
+static void print_crc32_tables();
+static void write_table(const uint32_t *, int);
+
 
 /* ========================================================================= */
 static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) {
@@ -40,7 +26,7 @@ static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) {
         square[n] = gf2_matrix_times(mat, mat[n]);
 }
 
-/*
+/* =========================================================================
   Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
   x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
 
@@ -66,121 +52,105 @@ static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) {
   allow for word-at-a-time CRC calculation for both big-endian and little-
   endian machines, where a word is four bytes.
 */
-void make_crc_table() {
-    uint32_t c;
+static void make_crc_table() {
     int n, k;
+    uint32_t c;
     uint32_t poly;                       /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
-    static volatile int first = 1;      /* flag to limit concurrent making */
     static const unsigned char p[] = {0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26};
 
-    /* See if another task is already doing this (not thread-safe, but better
-       than nothing -- significantly reduces duration of vulnerability in
-       case the advice about DYNAMIC_CRC_TABLE is ignored) */
-    if (first) {
-        first = 0;
-
-        /* make exclusive-or pattern from polynomial (0xedb88320) */
-        poly = 0;
-        for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
-            poly |= (uint32_t)1 << (31 - p[n]);
-
-        /* generate a crc for every 8-bit value */
-        for (n = 0; n < 256; n++) {
-            c = (uint32_t)n;
-            for (k = 0; k < 8; k++)
-                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
-            crc_table[0][n] = c;
-        }
+    /* make exclusive-or pattern from polynomial (0xedb88320) */
+    poly = 0;
+    for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
+        poly |= (uint32_t)1 << (31 - p[n]);
+
+    /* generate a crc for every 8-bit value */
+    for (n = 0; n < 256; n++) {
+        c = (uint32_t)n;
+        for (k = 0; k < 8; k++)
+            c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+        crc_table[0][n] = c;
+    }
 
-        /* generate crc for each value followed by one, two, and three zeros,
-           and then the byte reversal of those as well as the first table */
-        for (n = 0; n < 256; n++) {
-            c = crc_table[0][n];
-            crc_table[4][n] = ZSWAP32(c);
-            for (k = 1; k < 4; k++) {
-                c = crc_table[0][c & 0xff] ^ (c >> 8);
-                crc_table[k][n] = c;
-                crc_table[k + 4][n] = ZSWAP32(c);
-            }
+    /* generate crc for each value followed by one, two, and three zeros,
+       and then the byte reversal of those as well as the first table */
+    for (n = 0; n < 256; n++) {
+        c = crc_table[0][n];
+        crc_table[4][n] = ZSWAP32(c);
+        for (k = 1; k < 4; k++) {
+            c = crc_table[0][c & 0xff] ^ (c >> 8);
+            crc_table[k][n] = c;
+            crc_table[k + 4][n] = ZSWAP32(c);
         }
+    }
 
-        /* generate zero operators table for crc32_combine() */
-
-        /* generate the operator to apply a single zero bit to a CRC -- the
-           first row adds the polynomial if the low bit is a 1, and the
-           remaining rows shift the CRC right one bit */
-        k = GF2_DIM - 3;
-        crc_comb[k][0] = 0xedb88320UL;      /* CRC-32 polynomial */
-        uint32_t row = 1;
-        for (n = 1; n < GF2_DIM; n++) {
-            crc_comb[k][n] = row;
-            row <<= 1;
-        }
-        /* generate operators that apply 2, 4, and 8 zeros to a CRC, putting
-           the last one, the operator for one zero byte, at the 0 position */
-        gf2_matrix_square(crc_comb[k + 1], crc_comb[k]);
-        gf2_matrix_square(crc_comb[k + 2], crc_comb[k + 1]);
-        gf2_matrix_square(crc_comb[0], crc_comb[k + 2]);
-
-        /* generate operators for applying 2^n zero bytes to a CRC, filling out
-           the remainder of the table -- the operators repeat after GF2_DIM
-           values of n, so the table only needs GF2_DIM entries, regardless of
-           the size of the length being processed */
-        for (n = 1; n < k; n++)
-            gf2_matrix_square(crc_comb[n], crc_comb[n - 1]);
-
-        /* mark tables as complete, in case someone else is waiting */
-        crc_table_empty = 0;
-    } else {      /* not first */
-        /* wait for the other guy to finish (not efficient, but rare) */
-        while (crc_table_empty)
-            {}
+    /* generate zero operators table for crc32_combine() */
+
+    /* generate the operator to apply a single zero bit to a CRC -- the
+       first row adds the polynomial if the low bit is a 1, and the
+       remaining rows shift the CRC right one bit */
+    k = GF2_DIM - 3;
+    crc_comb[k][0] = 0xedb88320UL;      /* CRC-32 polynomial */
+    uint32_t row = 1;
+    for (n = 1; n < GF2_DIM; n++) {
+        crc_comb[k][n] = row;
+        row <<= 1;
     }
-    {
-        FILE *out;
-
-        out = fopen("crc32.h", "w");
-        if (out == NULL) return;
-
-        /* write out CRC table to crc32.h */
-        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
-        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
-        fprintf(out, "static const uint32_t ");
-        fprintf(out, "crc_table[8][256] =\n{\n  {\n");
-        write_table(out, crc_table[0], 256);
-        for (k = 1; k < 8; k++) {
-            fprintf(out, "  },\n  {\n");
-            write_table(out, crc_table[k], 256);
-        }
-        fprintf(out, "  }\n};\n");
-
-        /* write out zero operator table to crc32.h */
-        fprintf(out, "\nstatic const uint32_t ");
-        fprintf(out, "crc_comb[%d][%d] =\n{\n  {\n", GF2_DIM, GF2_DIM);
-        write_table(out, crc_comb[0], GF2_DIM);
-        for (k = 1; k < GF2_DIM; k++) {
-            fprintf(out, "  },\n  {\n");
-            write_table(out, crc_comb[k], GF2_DIM);
-        }
-        fprintf(out, "  }\n};\n");
-        fclose(out);
+    /* generate operators that apply 2, 4, and 8 zeros to a CRC, putting
+       the last one, the operator for one zero byte, at the 0 position */
+    gf2_matrix_square(crc_comb[k + 1], crc_comb[k]);
+    gf2_matrix_square(crc_comb[k + 2], crc_comb[k + 1]);
+    gf2_matrix_square(crc_comb[0], crc_comb[k + 2]);
+
+    /* generate operators for applying 2^n zero bytes to a CRC, filling out
+       the remainder of the table -- the operators repeat after GF2_DIM
+       values of n, so the table only needs GF2_DIM entries, regardless of
+       the size of the length being processed */
+    for (n = 1; n < k; n++)
+        gf2_matrix_square(crc_comb[n], crc_comb[n - 1]);
+}
+
+static void print_crc32_tables() {
+    int k;
+    printf("#ifndef CRC32_H_\n");
+    printf("#define CRC32_H_\n\n");
+    printf("/* crc32.h -- tables for rapid CRC calculation\n");
+    printf(" * Generated automatically by makecrct.c\n */\n\n");
+
+    /* print CRC table */
+    printf("static const uint32_t ");
+    printf("crc_table[8][256] =\n{\n  {\n");
+    write_table(crc_table[0], 256);
+    for (k = 1; k < 8; k++) {
+        printf("  },\n  {\n");
+        write_table(crc_table[k], 256);
+    }
+    printf("  }\n};\n");
+
+    /* print zero operator table */
+    printf("\nstatic const uint32_t ");
+    printf("crc_comb[%d][%d] =\n{\n  {\n", GF2_DIM, GF2_DIM);
+    write_table(crc_comb[0], GF2_DIM);
+    for (k = 1; k < GF2_DIM; k++) {
+        printf("  },\n  {\n");
+        write_table(crc_comb[k], GF2_DIM);
     }
+    printf("  }\n};\n");
+    printf("#endif /* CRC32_H_ */\n");
 }
 
-static void write_table(FILE *out, const uint32_t *table, int k) {
+static void write_table(const uint32_t *table, int k) {
     int n;
 
     for (n = 0; n < k; n++)
-        fprintf(out, "%s0x%08" PRIx32 "%s", n % 5 ? "" : "    ",
+        printf("%s0x%08" PRIx32 "%s", n % 5 ? "" : "    ",
                 (uint32_t)(table[n]),
                 n == k - 1 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
 }
 
-int main()
-{
+// The output of this application can be piped out to recreate crc32.h
+int main() {
     make_crc_table();
+    print_crc32_tables();
     return 0;
 }
-
-