I decided to deal with steganography, I was very interested in this topic, I found the implementation of the algorithm in C #, the implementation itself began to understand, entered the text in English and tried to hide it in the image, everything turned out and I was able to extract this text from the image. I decided that the problem was in the encoding and decided to load the text from the file with a similar line text = File.ReadAllText(open_dialog.FileName, Encoding.GetEncoding(1251)); but it did not help. Actually I decided to turn here.
Closed due to the fact that off-topic party PashaPash ♦ May 7 '17 at 22:45 .
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
- “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - PashaPash
- Please issue your question according to the rules of StackOverflow: ru.stackoverflow.com/help/quality-standards-error - user180704
- and here it is, useful: ru.stackoverflow.com/help/how-to-ask - user180704
- corrected, ok? - Mio
- 2the question is to include the code with which you are dealing, and which, for one reason or another, has caused you specific questions. Specifying a link to a page is not the best idea, since a link page can be removed tomorrow, and your question will lose its meaning, and if someone has a similar problem, your question will help him a little. - user180704
- The question was that they would help me find that in this code prevents the implementation of my ideas. They helped me. And I think on the answer in the bottom in the future, who will be bothered by a similar problem can figure it out. - Mio
|
1 answer
The problem with the code is that it considers char eight-bit.
For example, the code
// check if new 8 bits has been processed if (pixelElementIndex % 8 == 0) when recording and
// if 8 bits has been added, // then add the current character to the result text if (colorUnitIndex % 8 == 0) when reading spoil the high bits.
Characters in .NET are 16-bit regardless of which encoding you specify when reading. Encoding plays a role only in determining which character is read from a file, and the internal representation is always the same.
- Well, in fact, this is the principle of this algorithm, it takes 8 bits of rgb and changes the lower bits to get a new pixel - Mio
- @Mio: Well, yes, that’s the bug. The symbol is more than eight bits. The author of the code did not test it on non-English texts. - VladD
- At the expense of the bug, as I understood in .NET, fixing it will not work and it’s worth looking for another algorithm? - Mio
- @Mio: because the English characters contain zeros in the high byte, and therefore the loss of the high byte does not interfere. The fix will work, you just need to replace not eight bits, but all sixteen. Search all the places in the code where the author assumes an eight-bit
charme, sorry, laziness. See for yourself if you want. - VladD - And what to do with these 16 bits? What is the principle to replace with 8 bits RGB? - Mio
|