MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Karen.k
on 5 Nov 2012

string: 00001011000110110111100101111000011110000111101101101000000110100000011100001011000000110001101101101001

This string is suppose to contain a message, but everytime I try to decode it I get abstract letters and signs. Help?

*No products are associated with this question.*

Answer by Matt Fig
on 5 Nov 2012

How is the message stored? I.e., how many bits per letter, etc. It might help if you show how that string was generated from the ascii message.

Answer by Jan Simon
on 5 Nov 2012

Let's assume, that the code uses the same number of bits per character, so it it not run-length or Huffmann encoded. 104 has the factors 2,2,2,13, such that you have either 2, 4, 8, 13 or 26 bits per character, but even 104 bits are possible. E.g. this could be the ISBN number of a printed version of the Gettysburg address...

When We assume 8 bits, and the code is stored as sequential stream, we get these double values:

11, 27, 121, 120, 120, 123, 104, 26, 7, 11, 3, 27, 105

These are obviously not ASCII codes, because all values below 32 are non-printables like control characters. The numbers do not represent a simple character translation like a=1, b=2, ... A=27, B=28, because the value above 52 would be meaningless.

With 4 bits per character you can represent only 16 different values. Assuming the translation a=0,b=1,... you get:

alblhjhihihlgibkahaladblgj

This is not a word in a language I know.

Walter Roberson
on 5 Nov 2012

8-bit at a time implementation:

char(bin2dec(reshape(S,8,[]).'))

This will give char([11,27,121 (etc)]) as described in Jan's answer.

## 1 Comment

## Jan Simon

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/52748#comment_109257

Please do not post 2 questions about the same topic. See http://www.mathworks.com/matlabcentral/answers/52738-how-do-you-decode-a-binary-string-that-is-encrypted-in-ascii. It would be more helpful for the ones, who want to answer, if you answer question for clarifications and add new information by editing the original question. Thanks.

If you have any methods to decode this message, I strongly assume, that you have more information than you show. So please post at least the failing methods.