Reputation: 894
So as a class project I was trying to build a simple archive cracker. I was simply calling unzip
through the shell (using popen
) and iterating over a dynamically generated list of words.
Anyways, I setup a test archive with the password "hunter". Now I checked my program with easier passwords and I know it works. However for a lot of "long" passwords, the utility gives a weird error. So I tried, in the case of the above-mentioned archive, manually entering the following passwords:
So I thought maybe it was the utility at fault somehow I switched to Unarchiver, same issue with the same password string. Switched a different third party utility, same issue with the error being "Error on decrunching".
Why is this happening for certain passwords?
I am running macOS 10.12
Upvotes: 1
Views: 4865
Reputation: 112284
Unzip has a deliberately weak filter on an entered password to check it for validity. Only one byte of decrypted data is checked, so there is a 1/256 chance of a random password passing that check and proceeding to decompress. As you have discovered, in that case the decompression will soon thereafter detect an erroneous password.
Upvotes: 3