dhuertas/DES

Substraction of block bit position from 64

Michael2280309 opened this issue · 1 comments

The text block is a 64-bit integer. According to the initial permutation table we should have this algorithm:

  • Get 58-th highest bit from text block. Thus we right shift block by (58-1) = 57 then bitwise AND-ing it with 1.
  • But the code you wrote does right shifting by (64 - 58) = 6 positions. So we get the 7-th lower bit of the block instead of 58-th one.

Question: Are you considering the block to start from the lowest bit?

Hi @Michael2280309,

You may have missed the footnote when reading the DES FIPS document 😉

image