Palettes and GIF CSM25 Secure Information Hiding Learn How Images Are Represented Using a Palette Get an Overview of Hiding Techniques in GIF Et C
Total Page:16
File Type:pdf, Size:1020Kb
Learning outcomes Palettes and GIF CSM25 Secure Information Hiding Learn how images are represented using a palette Get an overview of hiding techniques in GIF et c. Dr Hans Georg Schaathun Understand how grayscale steganography can be adapted for University of Surrey palette images Spring 2007 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 1 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 2 / 30 Colour palettes The image format Colour palettes The image format The colour palette Using the colour palette The GIF file 0 1 The palette is a table of colours The GIF file format uses the colour palette Typically 256 for images 2 . in the spatial domain Sometimes 8 or 16 for screen view 3 Like the grayscale image, GIF is a matrix, I Each colour has an index 4 entry (x, y) defines the colour of pixel (x, y) The palette can be stored as 5 array of (say) 256 entries however Ix,y is the index of a colour in the palette each entry: RGB colour 6 A GIF file has to store both . using 3 × 8 bits A palette . The pixel matrix (pixmap) 255 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 4 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 5 / 30 Colour palettes The image format Colour palettes The palette in Matlab Which is best? Loading a palette image GIF? JPEG? ‘true colour’? Remember to store the palette [pixmap,palette] = imread ( ’picture.gif’ ) GIF saves space compared to ‘true colour’ imshow ( pixmap, palette ) Perfect representation of selected colours otherwise, treated as a weird grayscale image Perfect for drawings and computer graphics You can work on palette and pixmap separately where only selected colours are used >> [X,P] = imread ( ’krinslogo.gif’ ) ; JPEG is better for photos >> whos X P Colours are ‘truer’ Name Size Bytes Class Attributes can ‘blur’, losing contrast and detail P 256x3 6144 double X 120x90 10800 uint8 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 6 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 8 / 30 Colour palettes The palette in Matlab Colour palettes Steganography in the palette Exercise A simple idea Preliminaries Data hiding is possible Suppose a GIF file uses a 8-bit palette. How much space does in the palette this GIF file save compared to a 24-bit true-colour image? leaving the pixmap unaltered Consider a 64 × 64 image and a 512 × 768 image. Give the How? Any ideas? answer as a percentage. Two basic ideas How do you generate a random binary message (bit string) in changing colours matlab? changing order Look up in the help system and find the necessary commands to Main disadvantage: low capacity generate a random N binary (logical) matrix. Dr Hans Georg Schaathun Palettes and GIF Spring 2007 9 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 11 / 30 Colour palettes Steganography in the palette Colour palettes Steganography in the palette Changing colours Changing order Define a canonical colour order i.e. obtained by a deterministic sorting algorithm always same order, regardless of input order Minor changes to palette colours Assign colour indices according to canonical order as if they were pixels in ‘true colour’ only difference: there are only (say) 256 entries For each message, assign a permutation P on {1, 2, 3,..., N} (N For instance, LSB is palette size) Capacity 3 × 256 bits (= 768 bits) 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 12 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 13 / 30 Colour palettes Steganography in the palette Steganography in the pixmap What about LSB? Large-scale data hiding First attempt: LSB pixmap is main part of palette image file We still have a pixmap as before to hide a lot of data, the pixmap must be used Logical to attempt LSB the palette is small in the colour indices in selected pixels can cover a correspondingly small amount of data What happens? Dr Hans Georg Schaathun Palettes and GIF Spring 2007 14 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 16 / 30 Steganography in the pixmap What about LSB? Steganography in the pixmap What about LSB? Exercise What it looks like 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 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 18 / 30 Steganography in the pixmap What about LSB? Steganography in the pixmap Palette sorting So, what do we do? Three possible solutions Green areas, are not too bad Visible, but still green Brown is terrible Colour reduction It is suddenly green Colour sorting Why is this? Beyond sorting 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 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 21 / 30 Steganography in the pixmap Palette sorting Steganography in the pixmap Palette sorting Reduce the palette Sorting An ancient solution Another obvious one Sort the palette before embedding Reduce colour depth by 50% Consecutive colours similar 256 colours → 128 colours Unsort before shipping Sorted palette may be suspect Duplicate each colour (or use a slight variation of it) The original order should look innocent Such that colour i and colour i + 1 are identical (or almost) Many different sort orders Now LSB embedding is hardly perceptible visually Sort by luminence How do you steganalyse it? Travelling salesman (EzStego) Let (ri , bi , gi ) be RGB of colour i P255 2 2 2 Minimise i=0[(ri − ri+1) + (bi − bi+1) + (gi − gi+1) ] Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 23 / 30 Steganography in the pixmap Palette sorting Steganography in the pixmap Palette sorting Abandon sorting Sort order and colour difference according to Jessica Fridrich Input: Image I, Palette C = {c1, c2,..., cL}, Message m~ Output: Image J 2 What is the distance ||c1 − c2|| between colours? for each bit b of m~ 2 2 2 Euclidean: |R1 − R2| + |G1 − G2| + |B1 − B2| choose a pixel Ix,y Ignore chrominence: |Y1 − Y2| if Ix,y mod 2 6= b, then No obvious choice. find ci ∈ C such that ci mod 2 = b 2 Same problem for sorting and ‘abandon sorting’ and ||ci − Ix,y || is minimised Ix,y := ci end if end for Dr Hans Georg Schaathun Palettes and GIF Spring 2007 24 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 25 / 30 Steganalysis of palette images Steganalysis of palette images General principles Reading General approaches in the spatial domain Visual steganalysis Statistical steganalysis Core Reading . similar to other representations in the spatial domain David Wayner: Disappearing Cryptography Chapter 17 Structural steganalysis Consider the file format Does it look ‘normal’? Dr Hans Georg Schaathun Palettes and GIF Spring 2007 26 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 27 / 30 Steganalysis of palette images Steganalysis of palette images Structural steganalysis General, Spatial Approaches Most attacks on spatial, grayscale images apply Structural steganalysis considers file format et c. χ2/pairs of values Palette structure can be significant pairs analysis Duplicate colours? RS analysis Unusual palette order? Statistics may vary General structural artifacts (not limited to palette images) parameters may need tuning Resolution requirements; palette size; et c. reasoning is the same Bad or limited software can create artifacts Let’s explore it in excersises. Dr Hans Georg Schaathun Palettes and GIF Spring 2007 28 / 30 Dr Hans Georg Schaathun Palettes and GIF Spring 2007 29 / 30 Steganalysis of palette images Exercise Steganalysis Take the stego-images created in the previous message, and plot the χ2 statistic as a function of N. What do you observe? Remark Extra, challenging exercises on the exercise sheet on the web page. Dr Hans Georg Schaathun Palettes and GIF Spring 2007 30 / 30.