Binary files have got me beat!
Posted: Mon Mar 12, 2007 10:07 pm
I have been using runrev studio for about a month now and have found it very intuative to use while parsing text files into other formats, but when it comes to binary (hex) I am totally confused.
I want to read a binary file containg encrypted latitude and longditude data at offset $200 for 1 byte, evaluate the hex value of that byte, then depending on the hex value of that char, I would read then next 4 bytes into a variable say varLatitude then then the next 4 bytes into varEncryptedLongditude. To decrypt this data I need to XOR the two variables, the 4 byte answer would be the decrypted Longditude.
Now another problem is that these specific 4 byte strings are in 2's compliment notation (negative numbers being south and west, positive bieng north and east) they also appear to be written to the file back to front, (I believe this is something to do with Big Endian or Little endian)
The data was created on win32 and my runrev project will ony ever run on win32 so at least there are no cross platform issues to worry about here?
Maybe I have bitten off more than i can chew here for a begginer? But I really want to push my abilities in this area and i find the best way is to dive in!
I want to read a binary file containg encrypted latitude and longditude data at offset $200 for 1 byte, evaluate the hex value of that byte, then depending on the hex value of that char, I would read then next 4 bytes into a variable say varLatitude then then the next 4 bytes into varEncryptedLongditude. To decrypt this data I need to XOR the two variables, the 4 byte answer would be the decrypted Longditude.
Now another problem is that these specific 4 byte strings are in 2's compliment notation (negative numbers being south and west, positive bieng north and east) they also appear to be written to the file back to front, (I believe this is something to do with Big Endian or Little endian)
The data was created on win32 and my runrev project will ony ever run on win32 so at least there are no cross platform issues to worry about here?
Maybe I have bitten off more than i can chew here for a begginer? But I really want to push my abilities in this area and i find the best way is to dive in!