The final part of the decoding program performs the actual decoding: A two-byte hexadecimal string is converted into a value. That value is then manipulated by the XOR 0xAA operation. The result is output. Yep, it took a long time to get to this point.
Continue reading
Category Archives: Lesson
Encoding and Decoding, Part VI
Data encoded by my hexencode system is formatted. That means that the decoding program must look for both the header and footer in that formatted output. In last week’s Lesson, code was added to confirm the input file’s first line as the header. This week’s modification is to search for the end of encoded text.
Continue reading
Encoding and Decoding, Part V
You don’t want your decoding program to waste time attempting to process input that isn’t in the proper format. That’s why the encoding program bothers to put a specific header as the first line of text. Therefore, one of the first tasks for the decoding program is to check for that specific header.
Continue reading
Encoding and Decoding, Part IV
It would be a grand thing to set out and craft the entire decoding program in one sitting. That’s ambition in action, but it doesn’t demonstrate much programming experience.
Continue reading
Encoding and Decoding, Part III
You can output values in the hexadecimal format, thanks to the %x and %X placeholders in the printf() function. Getting hex strings as input is also possible, but not entirely obvious.
Continue reading
Encoding and Decoding, Part II
To help improve the presentation of encoded data, consider sprucing up the output.
Continue reading
Encoding and Decoding, Part I
A good way to exercise your C programming muscles is to work on a encoding/decoding project. This process makes you think about data and how it’s represented, and also how to work on both ends of an input/output puzzle.
Continue reading
On-the-fly Variables
Traditionally, a C program announces its variables at the start of a function block. The variables are presented by type and name, and they can be initialized at that time as well. This tradition isn’t a rule, and many C programmers break it.
Continue reading
Reading a File Randomly
Random file access isn’t about generating a random value and then reading at that position in the file. While you could do that, the term random access refers to file access that isn’t sequential. I suppose they could have called it dynamic file access, but I was only 8-years-old when computer scientists developed these concepts, so my input would not have been welcome.
Continue reading
Abuse the File Position Indicator
Files can be read sequentially or you can hop around, reading this chunk or that chunk, which is how random file access works. Internally, however, it’s all just file access. The difference between sequential and random file access is how the file position indicator is abused.
Continue reading