# Final permutation table example with DES

This question has been asked by another already but I can't comment on that.

There is a question in a book:

Find the output of initial permutation box when input given in hexadecimal as:

$\texttt{0x0002 0000 0000 0001}$

How does this input have two 1s at bits 15 and 64?

How do I look into the initial permutation table for the output:

$\texttt{0x0000 0080 0000 0002}$

Please also give any reference material.

• @schroeder Ok,I ask simply how 2nd byte-02 get into '80' and last byte to 02? Actually my Q is similarly asked by another one though i am unable to understand. Jul 5, 2017 at 6:58
• Head over to the Crypto exchange for in-depth crypto. Jul 5, 2017 at 13:00
• @JoshuaFaust So should I post this in Cryptoexchange? Jul 5, 2017 at 13:28
• @schroeder Yes, you certainly should. I have no doubt that many of us could answer this for you but the most appropriate place for this questions is the Crypto Exchange. Jul 5, 2017 at 14:53
• According to your link, the input is actually $\texttt{0x 0000 0080 0000 0002}$, not $\texttt{0x 0002 0000 0000 0001}$, which is the answer (and what you have as input). Is this what you intended? I answered the question as asked.
– user47922
Jul 5, 2017 at 16:11

The reference for DES is FIPS 46-3. See page 10 for the permutations.

Write $\texttt{0x0002 0000 0000 0001}$ in binary. Start with $\texttt{0x0002}$:

0: 0000 (bits 1-4)
0: 0000 (bits 5-8)
0: 0000 (bits 9-12)
2: 0010 <--bit 15 is 1 (bits 13-16)


Bits 17-48 are all 0. Now look at $\texttt{0x0001}$:

0: 0000 (bits 49-52)
0: 0000 (bits 53-56)
0: 0000 (bits 57-60)
1: 0001 <--bit 64 is 1 (bits 61-64)


Thus, bits 15 and 64 are set.

At this link, you can see the initial permutation and final permutation. It looks like the answer you're referring to is actually talking about the final permutation, so to match what you have, I'll be using that. Looking at the final permutation, the number "63" is the 15th bit, and the number "25" is the 64th bit. So your result is, in binary,

$\texttt{0000 0000 0000 0000 0000 0000 1000 0000}$ (bits 1-32, bit 25 set) $\texttt{0000 0000 0000 0000 0000 0000 0000 0010}$ (bits 33-64, bit 63 set)

$\texttt{0x0000 0080 0000 0002}$.

This is the final permutation, not the initial one.