palettes and gif - university of surrey...colour palettes the palette in matlab loading a palette...
Post on 06-Jul-2020
8 Views
Preview:
TRANSCRIPT
Palettes and GIFCSM25 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 paletteGet an overview of hiding techniques in GIF et c.Understand how grayscale steganography can be adapted forpalette images
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 2 / 30
Colour palettes The image format
Outline
1 Colour palettesThe image formatThe palette in MatlabSteganography in the palette
2 Steganography in the pixmapWhat about LSB?Palette sorting
3 Steganalysis of palette images
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 3 / 30
Colour palettes The image format
The colour palette
The palette is a table of coloursTypically 256 for imagesSometimes 8 or 16 for screen viewEach colour has an indexThe palette can be stored as
array of (say) 256 entrieseach entry: RGB colour. . . using 3 × 8 bits
0
1
2
3
4
5
6...
...255
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 4 / 30
Colour palettes The image format
Using the colour paletteThe GIF file
The GIF file format uses the colour palette. . . in the spatial domainLike the grayscale image,
GIF is a matrix, Ientry (x , y) defines the colour of pixel (x , y)
however Ix ,y is the index of a colour in the paletteA GIF file has to store both
A paletteThe 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 coloursPerfect for drawings and computer graphics
where only selected colours are usedJPEG 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
1 Colour palettesThe image formatThe palette in MatlabSteganography in the palette
2 Steganography in the pixmapWhat about LSB?Palette sorting
3 Steganalysis of palette images
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 PName Size Bytes Class AttributesP 256x3 6144 doubleX 120x90 10800 uint8
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 8 / 30
Colour palettes The palette in Matlab
ExercisePreliminaries
Suppose a GIF file uses a 8-bit palette. How much space doesthis GIF file save compared to a 24-bit true-colour image?Consider a 64 × 64 image and a 512 × 768 image. Give theanswer as a percentage.How do you generate a random binary message (bit string) inmatlab?Look up in the help system and find the necessary commands togenerate a random N binary (logical) matrix.
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 9 / 30
Colour palettes Steganography in the palette
Outline
1 Colour palettesThe image formatThe palette in MatlabSteganography in the palette
2 Steganography in the pixmapWhat about LSB?Palette sorting
3 Steganalysis of palette images
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 10 / 30
Colour palettes Steganography in the palette
A simple idea
Data hiding is possiblein the paletteleaving the pixmap unalteredHow? Any ideas?
Two basic ideaschanging colourschanging 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 possiblein the paletteleaving the pixmap unalteredHow? Any ideas?
Two basic ideaschanging colourschanging 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 possiblein the paletteleaving the pixmap unalteredHow? Any ideas?
Two basic ideaschanging colourschanging 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 coloursas if they were pixels in ‘true colour’only difference: there are only (say) 256 entries
For instance, LSBCapacity 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 orderi.e. obtained by a deterministic sorting algorithmalways same order, regardless of input order
Assign colour indices according to canonical orderFor each message, assign a permutation P on {1, 2, 3, . . . , N} (Nis palette size)Shuffle the palette using the permutation of the messageDecoder 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 fileto hide a lot of data, the pixmap must be usedthe 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
1 Colour palettesThe image formatThe palette in MatlabSteganography in the palette
2 Steganography in the pixmapWhat about LSB?Palette sorting
3 Steganalysis of palette images
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 beforeLogical 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?
ExerciseLSB test
Take any GIF image from the web. Some test GIF images can befound on the module web pages.
Make stego-images by embedding random binary messages oflength 10%, 30%, 50% and 75% of capacity in the least significantbit.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 badVisible, but still green
Brown is terribleIt is suddenly green
Why is this?Neighbour colour in the palette, can be
Similaror 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 badVisible, but still green
Brown is terribleIt is suddenly green
Why is this?Neighbour colour in the palette, can be
Similaror 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 badVisible, but still green
Brown is terribleIt is suddenly green
Why is this?Neighbour colour in the palette, can be
Similaror 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
1 Colour palettesThe image formatThe palette in MatlabSteganography in the palette
2 Steganography in the pixmapWhat about LSB?Palette sorting
3 Steganalysis of palette images
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 20 / 30
Steganography in the pixmap Palette sorting
Three possible solutions
Colour reductionColour sortingBeyond sorting
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 21 / 30
Steganography in the pixmap Palette sorting
Reduce the paletteAn ancient solution
Reduce colour depth by 50%
256 colours → 128 coloursDuplicate 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 visuallyHow do you steganalyse it?
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30
Steganography in the pixmap Palette sorting
Reduce the paletteAn ancient solution
Reduce colour depth by 50%
256 colours → 128 coloursDuplicate 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 visuallyHow do you steganalyse it?
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30
Steganography in the pixmap Palette sorting
Reduce the paletteAn ancient solution
Reduce colour depth by 50%
256 colours → 128 coloursDuplicate 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 visuallyHow do you steganalyse it?
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 22 / 30
Steganography in the pixmap Palette sorting
SortingAnother obvious one
Sort the palette before embeddingConsecutive colours similar
Unsort before shippingSorted palette may be suspectThe original order should look innocent
Many different sort ordersSort by luminenceTravelling salesman (EzStego)
Let (ri , bi , gi) be RGB of colour iMinimise
P255i=0[(ri − ri+1)
2 + (bi − bi+1)2 + (gi − gi+1)
2]
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 23 / 30
Steganography in the pixmap Palette sorting
Abandon sortingaccording to Jessica Fridrich
Input: Image I, Palette C = {c1, c2, . . . , cL}, Message ~mOutput: Image J
for each bit b of ~mchoose a pixel Ix ,yif Ix ,y mod 2 6= b, then
find ci ∈ C such that ci mod 2 = band ||ci − Ix ,y ||2 is minimised
Ix ,y := ciend if
end for
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 24 / 30
Steganography in the pixmap Palette sorting
Sort order and colour difference
What is the distance ||c1 − c2||2 between colours?Euclidean: |R1 − R2|2 + |G1 − G2|2 + |B1 − B2|2Ignore chrominence: |Y1 − Y2|
No obvious choice.Same problem for sorting and ‘abandon sorting’
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 25 / 30
Steganalysis of palette images
General principles
General approaches in the spatial domainVisual steganalysisStatistical steganalysis
. . . similar to other representations in the spatial domainStructural steganalysis
Consider the file formatDoes it look ‘normal’?
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 26 / 30
Steganalysis of palette images
Reading
Core Reading
David Wayner: Disappearing Cryptography Chapter 17
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 27 / 30
Steganalysis of palette images
Structural steganalysis
Structural steganalysis considers file format et c.Palette structure can be significant
Duplicate colours?Unusual palette order?
General structural artifacts (not limited to palette images)Resolution requirements; palette size; et c.Bad or limited software can create artifacts
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 28 / 30
Steganalysis of palette images
General, Spatial Approaches
Most attacks on spatial, grayscale images applyχ2/pairs of valuespairs analysisRS analysis
Statistics may varyparameters may need tuningreasoning is the same
Let’s explore it in excersises.
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 29 / 30
Steganalysis of palette images
ExerciseSteganalysis
Take the stego-images created in the previous message, and plot theχ2 statistic as a function of N. What do you observe?
RemarkExtra, challenging exercises on the exercise sheet on the web page.
Dr Hans Georg Schaathun Palettes and GIF Spring 2007 30 / 30
top related