Decompressing a gzip file by hand (sorta), part 2: Now with Huffman! - Thomas Tay's blog
Part 1 here: Link to part 1
Let’s decompress a gzip file by hand, just like we did last time in part 1, but this time let’s decode the decompressed huffman codes too.
Start by writing some data to disk:
$ echo "hector the frantic father on an anchor or a rare fat cat sat on the ranch" > test-huff.txt
$ xxd test-huff.txt
00000000: 6865 6374 6f72 2074 6865 2066 7261 6e74 hector the frant
00000010: 6963 2066 6174 6865 7220 6f6e 2061 6e20 ic father on an
00000020: 616e 6368 6f72 206f 7220 6120 7261 7265 anchor or a rare
00000030: 2066 6174 2063 6174 2073 6174 206f 6e20 fat cat sat on
00000040: 7468 6520 7261 6e63 680a the ranch.
Our file is 74 bytes this time, and specifically chosen to use only 13 characters:
thomastay.dev