Question

So I am trying to write a steganography program in java.

Here is what I have so far (the important parts)

  private void hideMessage(){
    byte[] messageBytes = message.getBytes();
    //message is a string
    int messageLength = messageBytes.length;
    for(int i = messageLength-1; i>=0; i--){
      imageBytes[i+100000] = messageBytes[i];
      //imageBytes is a bitmap image read into a byte array using imageIO
    }
  }

and

  private void getMessage(){
    int messageLength = 11;
    byte[] messageBytes = new byte[messageLength];
    for(int i = messageLength; i>0; i--){
      messageBytes[i-1] = imageBytes[i+10000];
    }
    message = new String(messageBytes);
  }

However this is the output I get for the string:

???????????

What am I doing wrong?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top