Class AnimatedGif
- java.lang.Object
-
- steganography.image.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 GIFbyte[]
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 gifboolean
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
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 interfaceSteganography
- Parameters:
carrier
- media used to hide the payloadpayload
- 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 payloadMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from carrierUnsupportedMediaTypeException
- if the Media Type (e.g. JPG) is not supportedMediaReassemblingException
- if a problem occurred during writing of the result mediaMediaCapacityException
- if the payload doesn't fit in the carrier
-
encode
public byte[] encode(byte[] payload, byte[] animatedGif, long seed) throws java.io.IOException, MediaNotFoundException, UnsupportedMediaTypeException, MediaReassemblingException, MediaCapacityException
Encodes a payload into the frames of an animated Gif and returns a gif- Specified by:
encode
in interfaceSteganography
- Parameters:
payload
- media used to hide the payloadanimatedGif
- data to hideseed
- 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 payloadMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from carrierUnsupportedMediaTypeException
- if the Media Type (e.g. JPG) is not supportedMediaReassemblingException
- if a problem occurred during writing of the result mediaMediaCapacityException
- if the payload doesn't fit in the carrier- See Also:
GIFMakerImageIO.splitGIF(byte[])
,GIFMakerImageIO.sequenzGIF(byte[][])
-
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 interfaceSteganography
- 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 steganographicDataMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from steganographicDataUnsupportedMediaTypeException
- if the Media Type (e.g. JPG) is not supportedUnknownStegFormatException
- if no hidden message was found
-
decode
public byte[] decode(byte[] stegGif, long seed) throws UnsupportedImageTypeException, NoImageException, java.io.IOException
Decodes a payload from an animated GIF- Specified by:
decode
in interfaceSteganography
- Parameters:
stegGif
- Media containing the hidden message to decodeseed
- 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 steganographicDataUnsupportedImageTypeException
NoImageException
- See Also:
GIFMakerImageIO.splitGIF(byte[])
,GIFMakerImageIO.sequenzGIF(byte[][])
-
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 interfaceSteganography
- 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 dataMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from dataUnsupportedMediaTypeException
- 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 interfaceSteganography
- Parameters:
data
- data to testseed
- 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 dataMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from dataUnsupportedMediaTypeException
- if the Media Type (e.g. JPG) is not supported
-
-