Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 17 Aug 2012 02:30:20 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
CC: Pavel Semjanov <pavel@...janov.com>
Subject: Re: Patch for pkzip_fmt_plug.c  from jumbo-6

On 2012-08-08 23:36, Pavel Semjanov wrote:
>>> It's quite simple. In CPU code, the block is checked for LZ type or
>>> PPM type. If it's LZ, the Huffman table test is used, like ZIP does.
>>
>> Thanks! So I can pre-test it more or less exactly like pkzip do? I
>> thought there would be differences between LZ2 and LZ. Does cRARk do
>> this fairly similar to Jim's pkzip code?
> 
> Any codes for Huffman table check are fairly similar ;)

Maybe on pseudo-code level. I found the pkzip code to be barely usable
as a starter (or I'm confused).

First, the byte order is different so I had to rework that. Second,
pkzip first reads nlen, ndist and ncode. I believe RAR has neither.
Third, pkzip seem to use fixed-length of three bits while RAR use
bitlength, zerocount of 4 bits each, 20 entries.

I'm not sure I'm even on the right track here.

This code from pkzip:

    left = 1;
    for (i = 1; i <= 7; ++i) {
        left <<= 1;
        left -= count[i];
        if (left < 0)
			return 0;	/* over-subscribed */
    }
    if (left > 0)
        return 0;		/* incomplete set */

...is this the actual table check? If I replace 7 with 15, should I be
able to use this provided I built the table correctly?

magnum

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.