Example #1
0
  /**
   * Codifica un byte en una imagen mediante el uso de técnicas de esteganografía
   *
   * @param originalByte Byte que se desea codificar
   */
  private void encodeByteInImage(byte originalByte) {
    for (int j = 0; j < 8; j++) {
      int index = pixelPath.getNextPathIndex();
      byte mask = (byte) (0x80 >> j);
      byte bit = (byte) (originalByte & mask);

      bit = (byte) (bit >> 7 - j);
      byte pixelValue = keyBitmap.getByte(index);
      mask = (byte) 0xFE;
      pixelValue &= mask;
      pixelValue |= bit;
      keyBitmap.setByte(index, pixelValue);
    }
  }
Example #2
0
 /**
  * Descodifica un byte a partir de una imagen mediante el uso de técnicas de esteganografía
  *
  * @return Byte obtenido de la imagen
  */
 private byte decodeByteFromImage() {
   byte currentByte = 0;
   for (int j = 0; j < 8; j++) {
     int index = pixelPath.getNextPathIndex();
     byte mask = (byte) (0x01);
     byte pixelValue = keyBitmap.getByte(index);
     byte bit = (byte) (pixelValue & mask);
     bit = (byte) (bit << 7 - j);
     currentByte = (byte) (currentByte | bit);
   }
   return currentByte;
 }