English 中文(简体)
Steganography(将文字写成平方档案)没有工作? [闭门]
原标题:Steganography (writing text into a png file) doesn t work? [closed]

我有一个向平方档案撰写文字档案的方案,但它并不奏效——在我打字时,图像重新显示错误的特性,有时图像不正确。 我的守则是:

public static void readText(String text, int[] pixArr, BufferedImage im, File outFile)
throws FileNotFoundException, IOException{
    char[] txt = text.toCharArray(); //Changes text file to array of characters
    int[] eightBit=new int[8]; //stores binary representation of characters
    for (int i=0;i<txt.length;i++){
        int hey=txt[i];
        for (int a=0;a<8;a++){     //converting text to binary
            eightBit[a]=hey%2;
            hey=hey/2;
            }
        eightBit=reverseArray(eightBit);
        insertion(pixArr, eightBit);
        }
    BufferedImage norm = new BufferedImage(im.getWidth(), im.getHeight(),
                                   BufferedImage.TYPE_INT_ARGB);
    norm.getGraphics().drawImage(im, 0, 0, null);
    ImageIO.write(im, "png", outFile);
    }   

public static void insertion(int[] pixArr, int[]eightBit){
    for (int i=0;i<pixArr.length;i++){
        for (int a=0;a<eightBit.length;a++){
            int temp=pixArr[i];
            temp=temp/2;
            temp*=2;
            pixArr[i++]=eightBit[a]+temp;
            }
        }
    }
问题回答

我认为,你需要从你的法典中退一步,看看你如何修改哪些数据结构。

You declare an array eightBit to keep track of the eight bits of one byte. That s neat. (It should be a subroutine so that you can more easily debug it.) But you had the results of the output to insertion(pixArr,eightBit). Follow that insertion() call and you ll see that you give it the same pixArr array every single call -- and have no mechanism to write into different portions of the pixArr array on subsequent calls.

best这一例行公文可以提供,是书写八条轨道。

哪八条轨道? 最后8个轨道。

但我从未见到<代码>int pixArr[>,从未被转回实际写上png的代码。

我强烈建议把这一问题分成小得多的片段,并逐条检验<>。

这确实回答了你的问题,但是如果你把你的名字放在外并使用有意义的可变名称,你就会发现你的法典很容易被削弱。 不是德特人,你不必把一切都 c到尽可能小的空间:

我肯定同意这一教训,即你应该把你的问题变成一个小的、独特的、可检验的分支;这将有助于你确定你们的法典中哪些部分以及哪些部分没有发挥作用。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...