Class AnimatedGif

  • All Implemented Interfaces:
    Steganography

    public class AnimatedGif
    extends java.lang.Object
    implements Steganography
    Author:
    Selina Wernike The class splits an animated gif into several single frame gifs or vice versa
    • Constructor Summary

      Constructors 
      Constructor Description
      AnimatedGif()  
    • Method Summary

      All Methods Instance Methods Concrete 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[] stegGif, long seed)
      Decodes a payload from an animated GIF
      byte[] encode​(byte[] carrier, byte[] payload)
      Encodes the given payload in the given carrier (image, mp3, ...) and returns the result.
      byte[] encode​(byte[] payload, byte[] animatedGif, long seed)
      Encodes a payload into the frames of an animated Gif and returns a gif
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnimatedGif

        public AnimatedGif()
    • Method Detail

      • encode

        public byte[] encode​(byte[] carrier,
                             byte[] payload)
                      throws java.io.IOException,
                             MediaNotFoundException,
                             UnsupportedMediaTypeException,
                             MediaReassemblingException,
                             MediaCapacityException
        Description copied from interface: Steganography
        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.
        Specified by:
        encode in interface Steganography
        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
      • decode

        public byte[] decode​(byte[] steganographicData)
                      throws java.io.IOException,
                             MediaNotFoundException,
                             UnsupportedMediaTypeException,
                             UnknownStegFormatException
        Description copied from interface: Steganography

        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.

        Specified by:
        decode in interface Steganography
        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
      • isSteganographicData

        public boolean isSteganographicData​(byte[] data)
                                     throws java.io.IOException,
                                            MediaNotFoundException,
                                            UnsupportedMediaTypeException
        Description copied from interface: Steganography

        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

        Specified by:
        isSteganographicData in interface Steganography
        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

        public boolean isSteganographicData​(byte[] data,
                                            long seed)
                                     throws java.io.IOException,
                                            MediaNotFoundException,
                                            UnsupportedMediaTypeException
        Description copied from interface: Steganography

        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

        Specified by:
        isSteganographicData in interface Steganography
        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