Must resist... decoding
Rob Conery has posted an interesting poem, I wouldn't really mind, except that he posted that in binary, which meant that I really had to figure it out.
Can you resist the urge
1110111 1101000 1111001 100000 1100100 1101001 1100100 100000 1111001 1101111 1110101 100000 1101101 1100001 1101011 1100101 100000 1101101 1100101 100000 1100100 1100101 1100011 1101111 1100100 1100101 100000 1100010 1101001 1101110 1100001 1110010 1111001 100000 1100100 1100001 1110100 1100001 111111
Comments
No, I couldn't resist the urge... but it did give me an opportunity to give my python scripting a quick refresher course.
...no I couldn't either...
StringBuilder sb = new StringBuilder();
foreach (string line in File.ReadAllLines(@"C:\temp\poem.txt"))
sb.Append( (char) Convert.ToByte(line, 2));
Console.Out.WriteLine("{0}", sb);
"There's no earthly way of knowing..."
I noticed the Rob's message contains only first part of ASCII table characters. Thus every byte always has 0 bit at position 8.
..and it seems Ayende noticed it too here... :) and his message contains 7 bits per character (not 8).
Who wants an answer - it's here (com on... decode it yourself... it's fun...):
http://dnagir.blogspot.com/2007/10/matrix-can-you-read-it.html
Cheers.
1000010 1100101 1100011 1100001 1110101 1110011 1100101 100000 1100010 1101001 1101110 1100001 1110010 1111001 100000 1101001 1110011 100000 1110100 1101000 1100101 100000 1101110 1100101 1110111 100000 1010010 1110101 1100010 1111001 101110 100000 1010010 1110101 1100010 1111001 100000 1110111 1100001 1110011 100000 1110011 1101111 100000 1010011 1100101 1110000 1110100 1100101 1101101 1100010 1100101 1110010 100000 110010 110000 110000 111000
Russel, LOL.
Dmitriy,
That is because we are using unicode, but talking in English.
I don't think there's something to do with Unicode. Eighth bit just represents Extended ASCII: http://en.wikipedia.org/wiki/Extended_ASCII
Unicode in most cases would take more than one byte and it would not be so easy to decrypt it here :)
But there's something to do that we all are talking in English :)
Hm, I just tested it with Hebrew, this is the output.
1110111 1101000 1111001 100000 1111111111111101 1111111111111101 100000 1111111111111101 1111111111111101 1111111111111101 1111111111111101 100000 1111111111111101 1111111111111101 100000 1111111111111101 1111111111111101 1111111111111101 1111111111111101 1111111111111101 111111
If I could only read Hebrew :) Maybe I'll meet a guy these days and he will translate me :)
Now you used some kind of Unicode (probably variable-length UTF-8?). It's still possible to have it in a single byte: http://en.wikipedia.org/wiki/Windows-1255
Now decoding can be a bit more complicated if you'll chose a "secret" encoding :)
I think you did something wrong there...
Also, I searched endlessly for the simplest way to parse a binary number. You'd think it'd be somewhere in Byte.Parse or Int32.Parse, but no... of course it's in Convert.ToByte(string, int). Go figure.
Here is my secret algorithm:
cy = "string to code"
for c in cy:
Hebrew has the longest bytes I ever seen 1111111111111101 LOL
0100111101101000001000000111001101110101011100100110010100101100001000000111100101101111011101010010011101110010011001010010000001100111011011110110100101101110011001110010000001110100011011110010000001101101011000010110101101100101001000000110110101100101001000000111011101110010011010010111010001100101001000000110001101101111011001000110010100100000011010010110111000100000011011110111001001100100011001010111001000100000011101000110111100100000011100100110010101100001011001000010000001100001011011100110010000100000011101110111001001101001011101000110010100100000011000010010000001100011011011110110110101101101011001010110111001110100001000000110111101101110001000000111100101101111011101010111001000100000011100000110111101110011011101000010111000100000010001000110111100100000011110010110111101110101001000000111011101100001011011100111010000100000011011010110010100100000011101000110111100100000011001000110111100100000011110010110111101110101011100100010000001101100011000010111010101101110011001000111001001111001001000000111010001101111011011110010000001110111011010000110100101101100011001010010000001001001001001110110110100100000011000010111010000100000011010010111010000111111
Bil,
you realize that you should have put spaces there, right? You had me re-write my decoding code.
And yes, as a matter of fact, I would. Do you do dry cleaning as well?
@Ayende: your "secret algorithm" has a bug, which makes decoding less than intuitive. You should've cast your chars to short rather than in, since the native encoding is UTF16.
Now repeat after me as I repeat after you: System.Text.Encoding.UTF8.GetBytes().
You are correct, except that Convert.ToString() will take care of it.
I still think this will get you signed/unsigned problems. Anyway, the only non-ascii character in your code is the repeated 1111111111111101 which doesn't translate to a hebrew character. I'm getting this:
"why ?? ???? ?? ??????" (the questionmarks are unidentified unicode characters)
My secret algorithm is this:
for line in System.IO.File.OpenText(argv[0]):
Avish, you cannot print Hebrew characters to the console.
Write them to a file, it should come up okay.
I was writing them to a file (piping not shown in original code). Gimme a little credit here :)
Also, if they are Hebrew characters, they're all the same single Hebrew character. The only Hebrew character I can think of that can come in so many repetitions is "ח", and I doubt you use that expression.
Comment preview