reset password
Author Message
PabloS
Posts: 20
Posted 15:32 Mar 08, 2014 |

I can encode and decode messages just fine, but when I try to decode black.ppm I can only decode some of the chars, the rest show up as question marks. So the message I get is a short, weird combination of symbols and question marks. Anybody else have this issue or have any ideas? Thanks

PabloS
Posts: 20
Posted 18:33 Mar 08, 2014 |

I figured out what it was. It has to do with the order in which you place your bits while decoding (and encoding) the message. I was doing it backwards. I hope nobody else wasted time on this and I'll clarify for anyone who wants more details.

Also, Keenan I think the char Z is not a good example for the HW explanation. You can read Z forward and backward the same 01011010.

 

sharokh23
Posts: 3
Posted 18:33 Mar 10, 2014 |

Can you please explain a little further, I am having the same problem.

PabloS
Posts: 20
Posted 18:55 Mar 10, 2014 |

Decoding black.ppm is a good measure to see if you are encoding and decoding correctly because you may be able to decode your own messages but when Keenan goes to grade it he won't be able to.

So, when you are reading the LSB in each byte and piecing a new char together you may be doing it backwards. For example you may see that the first 8 LSBs give you 0 1 1 0 0 0 1. When you start piecing that first char you may be putting together like this 1000110 ( which will give you a ? ) instead of like this 0110001 ( which is the char 'a' ). 

I used bitsets to print out the bits of each char that I "found." Then I realized that the bits were backwards! This wasn't clear in the HW explanation because the char Z is used as the example, which can be read the same both ways.

kknaur
Posts: 540
Posted 10:04 Mar 11, 2014 |

Yea sorry about the example, I didn't realize it was a palindrome until someone pointed it out to me.  I'll have to change the example if I ever give this assignment again.