Skip to main content

Reading Bits From Files

No replies
Joined: 2006-02-14

I am playing about with some encryption which needs to perform permutations and use S-Boxes on a 64 bit block. It's pretty similar to DES.
The problem is not with the method which encrypts the block, which is easy to write. But the fact that we must swap bits around means that the primitive data types are not suitable for storing the block and we must use a boolean array or bitset. My problem is how to retrieve information from a file bit-by-bit rather than byte-by-byte. I want to avoid writing a conversion method from bytes to boolean array.