Decode this binary : ) and how did you figure out?

See this image:


Note I might raise the points (however this is your own great brain exercise), but credit will be given to one who describes his approach in detail : )

Good luck.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The decoded binary says...

"I spent $100 at ThinkGeek and all I got was this lousy limited edition t-shirt."

This is based on 8 bit ascii.  I started from the end of the binary string and worked to the beginning converting as I went...  I'm sure there's a more optimal way but I was in a rush.  Enjoy!!  -Aaron

string str = "01001001001000000111001101110000011001010110111001110100001000000010010000110001001100000011000000100000011000010111010000100000010101000110100001101001011011100110101101000111011001010110010101101011001000000110000101101110011001000010000001100001011011000110110000100000010010010010000001100111011011110111010000100000011101110110000101110011001000000111010001101000011010010111001100100000011011000110111101110101011100110111100100100000011011000110100101101101011010010111010001100101011001000010000001100101011001000110100101110100011010010110111101101110001000000111010000101101011100110110100001101001011100100111010000101110";

string strMessage="";
int count=0;
string str_byte="";
for(int i=str.Length-1; i>=0; i--)
      str_byte = str[i]+str_byte;
            int  b = System.Convert.ToInt32( str_byte, 2 );
            char c = (char)b;
            strMessage = c + strMessage;
            count = 0;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Here comes a small real-mode standalone program for Intel x86-based DOS/Windows operating systems;
it comes down to 82 bytes, which might be slightly less than the solution presented earlier.
Of course it could be made even smaller by e.g. clever choice of system services, choice of opcodes and processing order,
but for a simple app that can decode any 'image file' that contains these ones and zeroes, I think it is pretty alright.
It handles redirection, so you can have it process either some file or your (terminated) keyboard input.
I tried to write it so that any old assembler would accept it. The code assumes DS=CS.

The idea is to decode eight characters represented by either ASCII '0's or '1's (all other input characters are skipped) into binary,
then to output the accumulated character (cooked) and keep repeating this until the input is exhausted.
The code utilises two DOS-level system services: read from file and write from file. This will allow to use command-line redirection.
The code is not as dense as it could be, for sake of readability and porting ease.

Tested on: DOS 6.22,Win95,Win98,Win4/SP6,Win2K/SP4,WinXP/SP1

Run using (program file 'DECODE.COM', input file 'image'):  DECODE <image

And the decoded text of course is
'I spent $100 at ThinkGeek and all I got was this lousy limited edition t-shirt.'
which is conveniently 79 bytes long to fit on a single line.

DOS      EQU      21h
COUNT      EQU      si
READ      EQU      3fh
WRITE      EQU      40h
ZERO      EQU      '0'
ONE      EQU      '1'

start:      jmp decode

Input            DB 0            ;for stdin
Output      DB 0            ;for stdout

      mov [Output],0      ;the accumulated byte
      mov COUNT,8      ;bit counter
      mov ah,READ      
      mov bx,0      ;stdin
      mov cx,1
      lea dx,Input      ;into ds:dx tiny model, ds=cs
      int DOS            ;read next input character
      cmp ax,0            ;none?
      jz quit

      ;accept only '0' and '1'
      cmp [Input],ZERO
      jz got0
      cmp [Input],ONE
      jz got1
      jmp next
      shl [Output],1      ;punch the zero
      jmp isdone
       shl [Output],1            
       or [Output],1      ;punch the one

       dec COUNT
      jnz next      ;loop until eight bits have been collected

      mov ah,WRITE
      mov bx,1      ;stdout
      mov cx,1
      lea dx,Output            
      int DOS            ;show the accumulated character

      jmp decode      ;keep on truckin'



PS. A curious fact about the 'image': when stored into a file with the exact layout presented in the question and
using DOS-type line termination (CR+LF) for each line except the last, the file length is 666 bytes. Should this mean anything? ;-)


Shane Russell2nd Line Desktop SupportCommented:
How do you decode it in visual basic just outta curiousty ?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.