Palettes and GIF CSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2007 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 1 / 30
Learning outcomes Learn how images are represented using a palette Get an overview of hiding techniques in GIF et c. Understand how grayscale steganography can be adapted for palette images Dr Hans Georg Schaathun Palettes and GIF Spring 2007 2 / 30
Colour palettes The image format Outline Colour palettes 1 The image format The palette in Matlab Steganography in the palette Steganography in the pixmap 2 What about LSB? Palette sorting Steganalysis of palette images 3 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 3 / 30
Colour palettes The image format The colour palette 0 1 The palette is a table of colours 2 Typically 256 for images 3 Sometimes 8 or 16 for screen view Each colour has an index 4 The palette can be stored as 5 array of (say) 256 entries 6 each entry: RGB colour . . . using 3 × 8 bits . . . . . . 255 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 4 / 30
Colour palettes The image format Using the colour palette The GIF file The GIF file format uses the colour palette . . . in the spatial domain Like the grayscale image, GIF is a matrix, I entry ( x , y ) defines the colour of pixel ( x , y ) however I x , y is the index of a colour in the palette A GIF file has to store both A palette The pixel matrix (pixmap) Dr Hans Georg Schaathun Palettes and GIF Spring 2007 5 / 30
Colour palettes The image format Which is best? GIF? JPEG? ‘true colour’? GIF saves space compared to ‘true colour’ Perfect representation of selected colours Perfect for drawings and computer graphics where only selected colours are used JPEG is better for photos Colours are ‘truer’ can ‘blur’, losing contrast and detail Dr Hans Georg Schaathun Palettes and GIF Spring 2007 6 / 30
Colour palettes The palette in Matlab Outline Colour palettes 1 The image format The palette in Matlab Steganography in the palette Steganography in the pixmap 2 What about LSB? Palette sorting Steganalysis of palette images 3 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 7 / 30
Colour palettes The palette in Matlab Loading a palette image Remember to store the palette [pixmap,palette] = imread ( ’picture.gif’ ) imshow ( pixmap, palette ) otherwise, treated as a weird grayscale image You can work on palette and pixmap separately >> [X,P] = imread ( ’krinslogo.gif’ ) ; >> whos X P Name Size Bytes Class Attributes P 256x3 6144 double X 120x90 10800 uint8 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 8 / 30
Colour palettes The palette in Matlab Exercise Preliminaries Suppose a GIF file uses a 8-bit palette. How much space does this GIF file save compared to a 24-bit true-colour image? Consider a 64 × 64 image and a 512 × 768 image. Give the answer as a percentage. How do you generate a random binary message (bit string) in matlab? Look up in the help system and find the necessary commands to generate a random N binary (logical) matrix. Dr Hans Georg Schaathun Palettes and GIF Spring 2007 9 / 30
Colour palettes Steganography in the palette Outline Colour palettes 1 The image format The palette in Matlab Steganography in the palette Steganography in the pixmap 2 What about LSB? Palette sorting Steganalysis of palette images 3 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 10 / 30
Colour palettes Steganography in the palette A simple idea Data hiding is possible in the palette leaving the pixmap unaltered How? Any ideas? Two basic ideas changing colours changing order Main disadvantage: low capacity Dr Hans Georg Schaathun Palettes and GIF Spring 2007 11 / 30
Colour palettes Steganography in the palette A simple idea Data hiding is possible in the palette leaving the pixmap unaltered How? Any ideas? Two basic ideas changing colours changing order Main disadvantage: low capacity Dr Hans Georg Schaathun Palettes and GIF Spring 2007 11 / 30
Colour palettes Steganography in the palette A simple idea Data hiding is possible in the palette leaving the pixmap unaltered How? Any ideas? Two basic ideas changing colours changing order Main disadvantage: low capacity Dr Hans Georg Schaathun Palettes and GIF Spring 2007 11 / 30
Colour palettes Steganography in the palette Changing colours Minor changes to palette colours as if they were pixels in ‘true colour’ only difference: there are only (say) 256 entries For instance, LSB Capacity 3 × 256 bits ( = 768 bits) Dr Hans Georg Schaathun Palettes and GIF Spring 2007 12 / 30
Colour palettes Steganography in the palette Changing order Define a canonical colour order i.e. obtained by a deterministic sorting algorithm always same order, regardless of input order Assign colour indices according to canonical order For each message, assign a permutation P on { 1 , 2 , 3 , . . . , N } ( N is palette size) Shuffle the palette using the permutation of the message Decoder can find canonical order (deterministic) and hence deduce P which maps to the message. N ! = 1 · 2 · 3 · . . . · N possible messages Approx. 1684 bits for an 8-bit palette Dr Hans Georg Schaathun Palettes and GIF Spring 2007 13 / 30
Colour palettes Steganography in the palette Large-scale data hiding pixmap is main part of palette image file to hide a lot of data, the pixmap must be used the palette is small can cover a correspondingly small amount of data Dr Hans Georg Schaathun Palettes and GIF Spring 2007 14 / 30
Steganography in the pixmap What about LSB? Outline Colour palettes 1 The image format The palette in Matlab Steganography in the palette Steganography in the pixmap 2 What about LSB? Palette sorting Steganalysis of palette images 3 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 15 / 30
Steganography in the pixmap What about LSB? First attempt: LSB We still have a pixmap as before Logical to attempt LSB in the colour indices in selected pixels What happens? Dr Hans Georg Schaathun Palettes and GIF Spring 2007 16 / 30
Steganography in the pixmap What about LSB? Exercise LSB test Take any GIF image from the web. Some test GIF images can be found on the module web pages. Make stego-images by embedding random binary messages of length 10 % , 30 % , 50 % and 75 % of capacity in the least significant bit. View the images. What does it look like? Extract the message again. Do you get the same message back? Hint: Reuse functions from previous exercises. Dr Hans Georg Schaathun Palettes and GIF Spring 2007 17 / 30
Steganography in the pixmap What about LSB? What it looks like Dr Hans Georg Schaathun Palettes and GIF Spring 2007 18 / 30
Steganography in the pixmap What about LSB? So, what do we do? Green areas, are not too bad Visible, but still green Brown is terrible It is suddenly green Why is this? Neighbour colour in the palette, can be Similar or far away Somehow, we have to change to a similar colour Dr Hans Georg Schaathun Palettes and GIF Spring 2007 19 / 30
Steganography in the pixmap What about LSB? So, what do we do? Green areas, are not too bad Visible, but still green Brown is terrible It is suddenly green Why is this? Neighbour colour in the palette, can be Similar or far away Somehow, we have to change to a similar colour Dr Hans Georg Schaathun Palettes and GIF Spring 2007 19 / 30
Steganography in the pixmap What about LSB? So, what do we do? Green areas, are not too bad Visible, but still green Brown is terrible It is suddenly green Why is this? Neighbour colour in the palette, can be Similar or far away Somehow, we have to change to a similar colour Dr Hans Georg Schaathun Palettes and GIF Spring 2007 19 / 30
Steganography in the pixmap Palette sorting Outline Colour palettes 1 The image format The palette in Matlab Steganography in the palette Steganography in the pixmap 2 What about LSB? Palette sorting Steganalysis of palette images 3 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 20 / 30
Steganography in the pixmap Palette sorting Three possible solutions Colour reduction Colour sorting Beyond sorting Dr Hans Georg Schaathun Palettes and GIF Spring 2007 21 / 30
Steganography in the pixmap Palette sorting Reduce the palette An ancient solution Reduce colour depth by 50 % 256 colours → 128 colours Duplicate each colour (or use a slight variation of it) Such that colour i and colour i + 1 are identical (or almost) Now LSB embedding is hardly perceptible visually How do you steganalyse it? Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30
Steganography in the pixmap Palette sorting Reduce the palette An ancient solution Reduce colour depth by 50 % 256 colours → 128 colours Duplicate each colour (or use a slight variation of it) Such that colour i and colour i + 1 are identical (or almost) Now LSB embedding is hardly perceptible visually How do you steganalyse it? Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30
Recommend
More recommend