Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 7 Jan 2012 02:46:06 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Bit slice implementation of DES based hashes

On Fri, Jan 06, 2012 at 05:51:20PM +0530, Piyush Mittal wrote:
> Extremely sorry to say but I am not getting how initial permutation is
> calculated? What I am doing is as follows:
...
> i.e 0000000011101000000000010010011100010111000001001100001010101111
> 
> but I am not getting the same sequence. What am I missing ?

The attached program prints the bit sequence above.  There are two
peculiarities: the initial block octets (represented by ASCII characters
in your case) were in big-endian bit order, and additionally the two
32-bit block halves need to be swapped.  The former is a property of DES
(or rather of its specs), whereas the latter I don't recall the origin of.

You might want to note that DES_raw_get_binary() does both of these
swaps, too: the former (bit endianness) by having mask go from 0x20 to 1
(and not the other way around) for the 6-bit values being decoded, and
the latter in DES_do_IP() (by XOR'ing the dst bit number with 0x20).

Alexander

View attachment "lm-ip.c" of type "text/plain" (562 bytes)

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.