Package steganography

Interface Steganography

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] decode​(byte[] steganographicData)
      Decodes a hidden message in the given steganographicData and returns it as a byte array.
      byte[] decode​(byte[] steganographicData, long seed)
      Decodes a hidden message in the given steganographicData and returns it as a byte array.
      byte[] encode​(byte[] carrier, byte[] payload)
      Encodes the given payload in the given carrier (image, mp3, ...) and returns the result.
      byte[] encode​(byte[] carrier, byte[] payload, long seed)
      Encodes the given payload in the given carrier (image, mp3, ...) and returns the result.
      boolean isSteganographicData​(byte[] data)
      Tests whether the given data has a hidden message encoded in it.
      boolean isSteganographicData​(byte[] data, long seed)
      Tests whether the given data has a hidden message encoded in it.
    • Method Detail

      • encode

        byte[] encode​(byte[] carrier,
                      byte[] payload)
               throws java.io.IOException,
                      MediaNotFoundException,
                      UnsupportedMediaTypeException,
                      MediaReassemblingException,
                      MediaCapacityException
        Encodes the given payload in the given carrier (image, mp3, ...) and returns the result. The format of the returned media will be the same as carrier. Carrier needs to be an exact media representation as it would be read from a file by an InputStream.
        Parameters:
        carrier - media used to hide the payload
        payload - data to hide
        Returns:
        steganographic data - exact media representation. Can be stored as it is to a file to open externally
        Throws:
        java.io.IOException - if a problem occurs during reading of carrier or payload
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from carrier
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
        MediaReassemblingException - if a problem occurred during writing of the result media
        MediaCapacityException - if the payload doesn't fit in the carrier
      • encode

        byte[] encode​(byte[] carrier,
                      byte[] payload,
                      long seed)
               throws java.io.IOException,
                      MediaNotFoundException,
                      UnsupportedMediaTypeException,
                      MediaReassemblingException,
                      MediaCapacityException

        Encodes the given payload in the given carrier (image, mp3, ...) and returns the result. The format of the returned media will be the same as carrier. Carrier needs to be an exact media representation as it would be read from a file by an InputStream.

        The Seed changes the way the payload is encoded. When decoding the result, the exact same Seed needs to be given to decode()

        Parameters:
        carrier - media used to hide the payload
        payload - data to hide
        seed - affects the resulting steganographic data (similar to a password)
        Returns:
        steganographic data - exact media representation. Can be stored as it is to a file to open externally
        Throws:
        java.io.IOException - if a problem occurs during reading of carrier or payload
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from carrier
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
        MediaReassemblingException - if a problem occurred during writing of the result media
        MediaCapacityException - if the payload doesn't fit in the carrier
      • decode

        byte[] decode​(byte[] steganographicData)
               throws java.io.IOException,
                      MediaNotFoundException,
                      UnsupportedMediaTypeException,
                      UnknownStegFormatException

        Decodes a hidden message in the given steganographicData and returns it as a byte array.

        steganographicData needs to be an exact media representation as it would be read from a file by an InputStream.

        This method only works if the message was encoded using no Seed or the respective default Seed. Otherwise it will throw an UnknownStegFormat as if no message was found.

        Parameters:
        steganographicData - Media containing the hidden message to decode
        Returns:
        the hidden message as a byte array
        Throws:
        java.io.IOException - if a problem occurs during reading of steganographicData
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from steganographicData
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
        UnknownStegFormatException - if no hidden message was found
      • decode

        byte[] decode​(byte[] steganographicData,
                      long seed)
               throws java.io.IOException,
                      MediaNotFoundException,
                      UnsupportedMediaTypeException,
                      UnknownStegFormatException

        Decodes a hidden message in the given steganographicData and returns it as a byte array.

        steganographicData needs to be an exact media representation as it would be read from a file by an InputStream

        This method only works if the message was encoded using the given Seed. Otherwise it will throw an UnknownStegFormatException as if no message was found.

        Parameters:
        steganographicData - Media containing the hidden message to decode
        seed - seed that was used to encode the given stenographicData
        Returns:
        the hidden message as a byte array
        Throws:
        java.io.IOException - if a problem occurs during reading of steganographicData
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from steganographicData
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
        UnknownStegFormatException - if no hidden message was found
      • isSteganographicData

        boolean isSteganographicData​(byte[] data)
                              throws java.io.IOException,
                                     MediaNotFoundException,
                                     UnsupportedMediaTypeException

        Tests whether the given data has a hidden message encoded in it. This method only works if the message was encoded using the given Seed or the respective default Seed. Otherwise it will always return false.

        The use of this method is discouraged. It saves very little resources compared to decode(...). So unless you need to test a lot of possible steganographicData, just use decode(...) and catch the UnknownStegFormatException

        Parameters:
        data - data to test
        Returns:
        true if the given data has a hidden message encoded in it
        Throws:
        java.io.IOException - if a problem occurs during reading of data
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from data
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
      • isSteganographicData

        boolean isSteganographicData​(byte[] data,
                                     long seed)
                              throws java.io.IOException,
                                     MediaNotFoundException,
                                     UnsupportedMediaTypeException

        Tests whether the given data has a hidden message encoded in it. This method only works if the message was encoded using the given Seed. Otherwise it will always return false.

        The use of this method is discouraged. It saves very little resources compared to decode(...). So unless you need to test a lot of possible steganographicData, just use decode(...) and catch the UnknownStegFormatException

        Parameters:
        data - data to test
        seed - seed the hidden message was encoded with
        Returns:
        true if the given data has a hidden message encoded in it
        Throws:
        java.io.IOException - if a problem occurs during reading of data
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from data
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported