Minimal ZIP file – part IV
=============================
This article is part of a series.
(DIR) Creating a valid ZIP-file
(DIR) Use .NET’s DeflateStream
(DIR) No dependencies (coding the DEFLATE algorithm)
- Calculating the CRC-32 👈
Introduction
-------------
From the start , a dependency on System.IO.Hashing was introduced to calculate the CRC-32/ISO-HDLC checksum.
(DIR) the start
First, a step back; the self-written ‘de flater’ (Dutch pun intended) from Part III is being written off. We want dealer-quality software and return to the version from Part II .
(DIR) Part III
(DIR) Part II
Source code
------------
The source code follows the standard CRC 1 algorithm. The implementation is naive and can be sped up by using lookup-tables (still true 2026 AD?) or a hardware implementation.
(DIR) 1
To make this work the package System.IO.Hashing is removed.
(DIR) Crc32.cs
Again, Info-ZIP’s zip agrees:
For extra verification, note the hash of ‘BANANABANANABANANABANANABANANA’ is 0x3dab2823 .
Conclusion
-----------
Depending on the definition of ‘done’, you could say that writing ZIP-files is not that difficult. But the devil is in the details!
Now go make your own. Some ideas:
- multiple files
- optimized deflate, use dynamic huffman
- other compression methods
- encryption
- 64-bit support
- disk spanning (.zip, .z01, .z02, .z03) :-)
----------------------------------
- Wikipedia: Cyclic redundancy check ↩︎
Wikipedia: Cyclic redundancy check ↩︎
(HTM) Cyclic redundancy check
(DIR) ↩︎
(DIR) previous Minimal ZIP file – part III
Related
--------
(DIR) Gopher enabled
(TXT) Goofy gopher (.svg)
(DIR) http2gopher
(TXT) /img/fallback.svg (.svg)
(DIR) Data compression 101
(TXT) /img/fallback.svg (.svg)
(DIR) [Talk] Datacompressie
(TXT) bits (.svg)
(DIR) Delphi Tetris
(IMG) Delphi Tetris (.png)
(DIR) PicoSearch - TF-IDF in 50 lines
(TXT) /img/fallback.svg (.svg)
(DIR) Software engineering, een volwassen vak?
(IMG) Boekje (.jpeg)
(DIR) Blaztris
(TXT) /img/fallback.svg (.svg)
(DIR) Upgrade application without source code
(TXT) Bits (.svg)
(DIR) Colossus PoC
(IMG) screenshot of colossus visualiser and malfunction controller (.png)