Live data from Hacker News

Repairing Corrupted ZIP Files by Brute Force Scanning in C

blog.zx2c4.com

1–10 of 28 posts

Re: Repairing Corrupted ZIP Files by Brute Force Scanning in C

#3
+1 for questioning or ignoring commonly accepted assumptions.

Such as that compressed archives are hard if possible at all to repair. Or, say, that the optimal encoding is a very hard problem... something that David Huffman simply didn't know when he came up with his coding algorithm.

Re: Repairing Corrupted ZIP Files by Brute Force Scanning in C

#5
post #4

Very cool article. If you are going to have a bunch of packed structs, though, it's often easier to wrap all the structs in #pragma pack(0)/pack() rather than putting the attribute on each member. This is an MSism, but it works in gcc.

Thanks a lot for this tip! Saves a lot of writing. I knew there had to be a better way...

Ideally, I guess I wouldn't read directly into a struct, though, and instead use the right functions from endian.h to make the code portable, but ah! such is life when you're scrambling to save a zip and the post-graduation nostalgia is high and the post-coffee-crash caffeination is low.

Re: Repairing Corrupted ZIP Files by Brute Force Scanning in C

#6
When I use my hacking skills for something like this, I sometimes fear that I am wasting time and a normal person would have solved this problem faster and easier because he isn't focused on programming all the time.

Nice to see that the fun way is the right way in this case.

Post reply on HN