Skip BMP header for DES encryption
I am writing an implementation of a DES encryption with a 64 bit plaintext, taken from the pixel information in a BMP file. So I want to skip the header which is 54 bytes, but I am not sure how to do this. This will not be a dynamic project, in the sense that I will always use the same BMP file (as I am producing both a CBC and EBC mode BMP file at the program finish)
If you have no idea what I am talking about, check out this link.
http://www.giac.org/resources/whitepaper/cryptography/62.php
So I would like to open the bmp file, skip the first 54 bytes, then consecutively read 8 byte blocks and encrypt them. I just don't know very much about using files in C++.
weasel7711
Junior Poster in Training
82 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
Thank you. I do have one question though. What does the ios::binary do, does that translate the hex digits into binary when read into the buffer?
weasel7711
Junior Poster in Training
82 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
What I am planning on doing is bitwise operation on the 8 bytes read in from the file. I was thinking of converting the 8 bytes to an integer value, then I remembered ints in windows are 4 bytes. Is a long 8 bytes? And is there a way to convert the 8 bytes read in to the buffer into a long value I can manipulate?
weasel7711
Junior Poster in Training
82 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
Why would you want to convert it to something of you can just manipulate it one byte at a time?
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
How do I manipulate the bytes if they are stored as chars?
weasel7711
Junior Poster in Training
82 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0