3 ms·
I was curious and yes, I reproduce your numbers. A robust zip decoder can beat those odds. It can bail on a nominal start position by considering a bit more t
by frumiousirc 4y ago
I was curious and yes, I reproduce your numbers.
A robust zip decoder can beat those odds.
It can bail on a nominal start position by considering a bit more than the local file header signature magic word.
The next two bytes is a minimum version needed to extract and its legal values are sparse. A bit further comes 2 bytes giving the compression method which also has sparse values. I'd guess sparse values (small integers) are more likely to be found in a "random" non-zip stream but would still reduce the collision probability.
Then there are CRCs. These can greatly reduce the collision probability at the cost of the decoder doing speculative work which gets thrown away if a CRC fails to replicate.