the_Foundation [release-1.0]

Fixed calculation of CRC-32

=> 7d698c1bd64d0f112157d4d0ec209588c2aebe2a

diff --git a/src/crc32.c b/src/crc32.c
index e2b48ff..2b11269 100644
--- a/src/crc32.c
+++ b/src/crc32.c
@@ -122,10 +122,9 @@ uint32_t iCrc32(const char *data, size_t size) {
         0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
         0x2d02ef8dL
     };
-
-    uint32_t crc32 = 0;
+    uint32_t crc32 = 0xffffffffu;
     for (size_t i = 0; i < size; ++i) {
         crc32 = crc32_tab[(crc32 ^ data[i]) & 0xff] ^ (crc32 >> 8);
     }
-    return crc32;
+    return ~crc32;
 }
Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/release-1.0/cdiff/7d698c1bd64d0f112157d4d0ec209588c2aebe2a
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
29.987051 milliseconds
Gemini-to-HTML Time
0.171737 milliseconds

This content has been proxied by September (ba2dc).