How do I decode a binary string that is 1X104 characters long that is written in ASCII?
显示 更早的评论
string: 00001011000110110111100101111000011110000111101101101000000110100000011100001011000000110001101101101001
This string is suppose to contain a message, but everytime I try to decode it I get abstract letters and signs. Help?
1 个评论
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.
回答(2 个)
Matt Fig
2012-11-5
0 个投票
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.
Jan
2012-11-5
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.
1 个评论
Walter Roberson
2012-11-5
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.
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!