Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 17 Aug 2012 04:00:27 +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-17 02:30, magnum wrote:
> On 2012-08-08 23:36, Pavel Semjanov wrote:
>> 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.

Never mind, I got it working now. After adjusting for the above, the
below check works fine.

> 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?

Lots of thanks for the hints!

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.