csm25 secure information hiding dr hans georg schaathuncsm25 secure information hiding dr hans georg...

138
Basics of Steganography CSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 1 / 54

Upload: others

Post on 30-Jun-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Basics of SteganographyCSM25 Secure Information Hiding

Dr Hans Georg Schaathun

University of Surrey

Spring 2009 – Week 1

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 1 / 54

Page 2: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 2 / 54

Page 3: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

Free thinkers and free speech

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 3 / 54

Page 4: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

The other side

Both clips:The Independent, Friday 27 October 2006.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 4 / 54

Page 5: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

The Outcomes and Expectations

Pass (50+)Implement simple stego-systems and steganalysis techniquesBe able to interpret steganalytic dataUse the basic terminology correctly and unambiguously

Merit (60+) (additionally)Program cleanly and show good structure in any delivarables.Have some (limited) wider overview of steganography and itsrelations to other research areas.

Distinction (70+) (additionally)Be able to assess security properties in a communications system,and assess security needs in an application.Be able to discuss stego-systems in unambiguous terms, andchoose appropriate approaches for given application needs.Be able to generalise theories and techniques in steganography,and relate and contrast different approaches.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 5 / 54

Page 6: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

The Outcomes and Expectations

Pass (50+)Implement simple stego-systems and steganalysis techniquesBe able to interpret steganalytic dataUse the basic terminology correctly and unambiguously

Merit (60+) (additionally)Program cleanly and show good structure in any delivarables.Have some (limited) wider overview of steganography and itsrelations to other research areas.

Distinction (70+) (additionally)Be able to assess security properties in a communications system,and assess security needs in an application.Be able to discuss stego-systems in unambiguous terms, andchoose appropriate approaches for given application needs.Be able to generalise theories and techniques in steganography,and relate and contrast different approaches.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 5 / 54

Page 7: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

The Outcomes and Expectations

Pass (50+)Implement simple stego-systems and steganalysis techniquesBe able to interpret steganalytic dataUse the basic terminology correctly and unambiguously

Merit (60+) (additionally)Program cleanly and show good structure in any delivarables.Have some (limited) wider overview of steganography and itsrelations to other research areas.

Distinction (70+) (additionally)Be able to assess security properties in a communications system,and assess security needs in an application.Be able to discuss stego-systems in unambiguous terms, andchoose appropriate approaches for given application needs.Be able to generalise theories and techniques in steganography,and relate and contrast different approaches.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 5 / 54

Page 8: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

Exercises and Assessment

Weekly exercises One exercise sheet given after each lecture. This isto be done at home, and peer-assessed and/or discussedin the next session.

Portfolio (50%) To be handed in at the end of module, summarisingyour learning, including answers to some of the weeklyexercises. (As in csm27.)

Poster (20% collective mark) A poster on a chosen topic is to beprepared in groups of 3-5 and presented to the class inWeek 12.

Exam (30%) A short (112h) written exam at the end of term. This exam

will test your ability to interpret steganalytic data similar towhat you produce in the lab-based exercises. (It may alsotest other areas of the syllabus.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 6 / 54

Page 9: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

The module

Lesson Objectives

After the session, you shouldhave an initial understanding of what steganography is and how itcould be usedbe able to write readable and reusable Matlab code, usingcomments, inline help text, and functions.understand how any piece of information can be represented indifferent ways.

In particular, convert text to binary.have implemented LSB embedding using the principles above

(by the end of Week 2, using the lab session)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 7 / 54

Page 10: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 8 / 54

Page 11: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 12: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 13: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 14: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 15: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

I wonder what they areup to, Alice and Bob. . .

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 16: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

About Uncle Charlie who isill.

Family matters. Noneof my business.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 17: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Discussing escape plans.

Oh dear. That’s maxi-mum security for Bob.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 18: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic problemSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Qvfphffvat rfpncr cynaf.

Encrypted?! They sureare up to no good.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 19: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The visionSimmons Crypto’83

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob

William theWarden

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Escape at midnight.

«Uncle Charlie is muchbetter now.»

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 9 / 54

Page 20: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 21: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Eve

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 22: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Eve

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 23: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Eve

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 24: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Eve

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

What is the password?

Transaction data.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 25: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models The problem

The basic crypto-problemEncryption

Alice

.

................................

.............

..................................

..........

......................................

.....

..........................................

.........................................

........................................

....................................... ...................................... ..................................... ..................................... .............................................................................

........................................

.........................................

..........................................

...........................................

............................................

.............................................

Bob theBanker

Eve

.

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

.........

......

Genafnpgvba qngn.

Sigh! Encrypted.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 10 / 54

Page 26: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Threats and Controls

Threats and controlsCSM27 Re-cap – See Pfleeger&Pfleeger Ch. 1

Assets Resource and fascilities we value and don’t want to lose.Threat A potential damage or cause of damage to the assets.

Control Any security measures used to reduce the risk (eitherprobability or severity of damage) of damage fromexisting threats.

Vulnerabilities Weaknesses (bugs etc) in the system which increasesthe risk of damage from existing threats.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 11 / 54

Page 27: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Threats and Controls

Discussion exercise

Groups of about 3-4.Discuss the steganography and encryption scenarioes presented,and identify

1 The assets we seek to protect2 Threats against these assets3 The threats controlled (respectively) by steganography and

encryption

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 12 / 54

Page 28: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Threats and Controls

Combining Encryption and Steganography

You can increase security of a steganographic system byencrypting the message before hiding it. (common claim)

In what way is the claim true?In what way is the claim false?

Steganography and encryption control different threats.Combining the controls control more threatsCombining the controls does not reduce the risk of each threat.

Hence, encryption does not improve the security ofsteganography.

It adds controls outside the scope of steganography.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 13 / 54

Page 29: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Threats and Controls

Combining Encryption and Steganography

You can increase security of a steganographic system byencrypting the message before hiding it. (common claim)

In what way is the claim true?In what way is the claim false?Steganography and encryption control different threats.

Combining the controls control more threatsCombining the controls does not reduce the risk of each threat.

Hence, encryption does not improve the security ofsteganography.

It adds controls outside the scope of steganography.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 13 / 54

Page 30: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Threats and Controls

Lesson

Be wary of general claims of security.Address the protection of each asset separately.Address the control of each threat separately.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 14 / 54

Page 31: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

Information hiding

Information Hiding is a more general problemHide one file (message) in another file (host)Different subproblems – different purposes

Steganography – secret communicationsRobust Watermarking – e.g. copyright protectionFragile Watermarking – authentication

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 15 / 54

Page 32: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemThe pure stego-system

Embedding Extractor

Message Recovered

Key

Cover

File

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 33: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemThe pure stego-system

Embedding Extractor

Message Recovered

Key

Cover

File

Security depends on the confidentiality of the algorithm.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 34: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSecret-key stego-system

Embedding Extractor

Message RecoveredKey

Cover

File

The key k is shared confidentially by Alice and Bob.Gives Bob an edge over Eve.

Without the key, the stego-text is indistinguishable from any othercover textWe will return to this [Kerckhoffs principles]

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 35: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSecret-key stego-system

Embedding Extractor

Message RecoveredKey

Cover

File

The key k is shared confidentially by Alice and Bob.Gives Bob an edge over Eve.

Without the key, the stego-text is indistinguishable from any othercover textWe will return to this [Kerckhoffs principles]

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 36: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSecret-key stego-system

Embedding Extractor

Message RecoveredKey

Cover

File

The key k is shared confidentially by Alice and Bob.Gives Bob an edge over Eve.

Without the key, the stego-text is indistinguishable from any othercover textWe will return to this [Kerckhoffs principles]

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 37: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSecret-key stego-system

Embedding Extractor

Message RecoveredKey

Cover

File

Why is the cover-text fed as input?It has no value at the receiver

Red herring.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 38: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSignificance of the Cover Image

Embedding Extractor

Message RecoveredKey

File

Why is the cover-text fed as input?It has no value at the receiver

Red herring.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 39: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemSignificance of the Cover Image

Embedding Extractor

Message RecoveredKey

File

Why is the cover-text fed as input?It has no value at the receiver

Red herring.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 40: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemWatermarking System

Embedding Extractor

Message RecoveredKey

Cover File

The cover image is a legacy from watermarking.Watermarking ties the message to the cover.

The cover image is essential at the receiver.

In Steganography, the cover image may be chosen or generatedinternally at the encoder.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 41: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

The data hiding systemWatermarking System

Embedding Extractor

Message RecoveredKey

Cover File

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 16 / 54

Page 42: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

Watermarking vs. Steganography

Watermarking: the cover-image is essentialTwo receivers:

One observes the cover-imageOne extracts the hidden message

Minimum distortion is importantSteganography: What is the use of cover-image at receiver?

Bob wants the messageThe image is a red herringDistortion (relative the original cover) is irrelevant

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 17 / 54

Page 43: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

Two key differencesWatermarking vs. Steganography

1 Cover-imageimportant in watermarkingmeaningless in steganography

2 AttackerSteganography: determine whether secret information exists or notWatermarking: various other goals

Change cover-textRemove watermarkChange watermark

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 18 / 54

Page 44: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

SteganographyCryptographic view

A Secret-Key stego-system (by synthesis) is S = (C, M, K , E , D)where

C : set of cover textsM : set of messagesK : key space (set of possible keys)E is an encoding function, E : K ×M → CD is a decoding function, D : K × C → M

such thatPr(D(k , E(k , m)) = m) ≈ 1.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 19 / 54

Page 45: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

Steganography from Information Hiding

Secret-Key Stego-system by modificationThe encoding function takes a cover text from C as input

E : K × C ×M → C

Pure stego-system (by modification)The encoding function takes a cover text from C as input, and nokey is used

E :C ×M → CD :C → M

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 20 / 54

Page 46: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

On Pure Stegosystems

Bob has no advantage over Evehe has no information which Eve does not have

What prevents Eve from breaking the system?Evidently the algorithm must be secret.Once it is broken, it cannot be reused.Keyed systems can be reused with a new key

if they are properly designed

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 21 / 54

Page 47: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

On Pure Stegosystems

Bob has no advantage over Evehe has no information which Eve does not have

What prevents Eve from breaking the system?Evidently the algorithm must be secret.Once it is broken, it cannot be reused.Keyed systems can be reused with a new key

if they are properly designed

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 21 / 54

Page 48: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

On Pure Stegosystems

Bob has no advantage over Evehe has no information which Eve does not have

What prevents Eve from breaking the system?Evidently the algorithm must be secret.Once it is broken, it cannot be reused.Keyed systems can be reused with a new key

if they are properly designed

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 21 / 54

Page 49: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models What steganography is

To remember

The cover-text is a red herring in steganography.The standard definitions of pure steganography and secret-keysteganography apply to a very limited class of steganography,based on data hiding.Cover-text irrelevant ⇒ distortion irrelevant.

PSNR used to measure distortion in Watermarking.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 22 / 54

Page 50: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe tools

Definition (Cipher)A system which allows Alice and Bob to communicate secretly withoutEve being able to learn the contents of the communication.

Encryption refers to the process of applying a cipher.

Definition (Stego-system)A system which allows Alice and Bob to communicate secretly withoutEve knowing that any secret communication is taking place.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 23 / 54

Page 51: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe tools

Definition (Cipher)A system which allows Alice and Bob to communicate secretly withoutEve being able to learn the contents of the communication.

Encryption refers to the process of applying a cipher.

Definition (Stego-system)A system which allows Alice and Bob to communicate secretly withoutEve knowing that any secret communication is taking place.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 23 / 54

Page 52: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe tools

Definition (Cipher)A system which allows Alice and Bob to communicate secretly withoutEve being able to learn the contents of the communication.

Encryption refers to the process of applying a cipher.

Definition (Stego-system)A system which allows Alice and Bob to communicate secretly withoutEve knowing that any secret communication is taking place.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 23 / 54

Page 53: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe tools

Definition (Cipher)A system which allows Alice and Bob to communicate secretly withoutEve being able to learn the contents of the communication.

Encryption refers to the process of applying a cipher.

Definition (Stego-system)A system which allows Alice and Bob to communicate secretly withoutEve knowing that any secret communication is taking place.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 23 / 54

Page 54: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 55: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 56: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 57: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 58: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 59: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe disciplines

Definition (Steganography)

The study of (and art of developing) stego-systems.

Definition (Cryptography)

A general term encompassing the study of ciphers and othertechnology for secure communications.

Cryptography is more than ciphersDigital signaturesAuthorisation protocolsSteganography

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 24 / 54

Page 60: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe countermeasures

Definition (Steganalysis)

The art of detecting whether secret communications is taking place ornot.

Definition (Cryptoanalysis)The art of breaking any cryptographic system, most often referring tobreaking ciphers, i.e. to find the contents of secret communications.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 25 / 54

Page 61: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

DefinitionsThe countermeasures

Definition (Steganalysis)

The art of detecting whether secret communications is taking place ornot.

Definition (Cryptoanalysis)The art of breaking any cryptographic system, most often referring tobreaking ciphers, i.e. to find the contents of secret communications.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 25 / 54

Page 62: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Steganography models Definitions

Steganography versus Cryptography

We define Steganography by its objective (control a specificthreat).

We don’t make any assumptions on how it works.

Cryptography includes SteganographyModern cryptography does assume certain principles andmethods

not all Steganography qualifies as modern Cryptography.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 26 / 54

Page 63: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Intro to Matlab

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 27 / 54

Page 64: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Intro to Matlab

Matlab

Matlab (Matrix Laboratory)interpreted programming languageinteractive numerical tool

Particular strengthsGood matrix processing (efficient and syntactically simple)Good libraries for many areas, including image processingRelatively simple for prototyping

(Brief Demo)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 28 / 54

Page 65: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 29 / 54

Page 66: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

A tiny grayscale example

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 30 / 54

Page 67: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

A tiny grayscale example

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 30 / 54

Page 68: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

The image file: pgm/pnm (spatial domain)

P224 242550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 97 86 26 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36 171 85 54 35 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 22 0 0 52 260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 146 0 0 0 52 260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 146 0 0 0 52 260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 146 0 0 0 12 77 260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 146 0 0 0 49 139 200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36 146 132 0 0 0 32 94 150 0 0 0 0 0 0 0 0 0 0 0 12 111 122 65 79 99 0 0 0 0 47 230 0 0 0 0 0 0 0 0 0 0 73 111 128 88 22 0 79 0 0 0 0 97 490 0 0 0 0 0 0 0 0 36 146 132 102 26 17 0 0 19 59 0 0 0 97 490 0 0 0 0 0 12 111 122 65 79 19 0 0 0 0 0 0 66 13 0 77 81 00 0 0 0 0 73 111 128 88 22 0 0 0 0 0 0 0 0 26 101 97 103 15 00 0 0 36 146 132 102 26 17 0 0 0 0 0 0 0 0 0 6 37 49 11 0 012 49 142 149 79 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 049 173 77 47 41 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 012 37 6 57 99 71 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 128 137 70 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 171 49 0 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 33 36 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 31 / 54

Page 69: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Image formats

Distinguish betweenImage format e.g. pixmap (spatial domain)

How the image is represented.File format

How the image data are stored on disk.A file format may contain metadata + image datapnm (netpbm), png, and Microsoft-BMP containpixmap images.TIFF can carry different image formats

JPEG is an image format and a compression algorithmThe JPEG standard does not define a file formatJFIF, EXIF, and TIFF all support JPEG data

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 32 / 54

Page 70: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Images in Matlab

Load pixmap image: I = imread (filename)The pixmap is stored as a matrix.

If the file is not a pixmap,then the image is converted (by imread)possible rounding errormetadata are lost (always, also for pixmap formats)

Some stego-systems based on JPEG are vulnerableA JPEG file is converted (decompressed) and recompressed beforeembeddingThe double compression leads to artifacts which can be exploited

You should know which image format you work with

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 33 / 54

Page 71: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Data types

A Matlab image are usually eitheruint8: Integers [0, 255]double: Floating point [0, 1]

Any range is possible, but imshow makes assumptionsSuppose img is a uint8 image.Convert: dblimg = double ( img ) (does not change range.What does imshow(dblimg) display?Assumed range [0, 1]; anything > 1 is treated as 1.

imshow(dblimg,[0,255]) lets you define the rangeData hiding often requires type conversion

always remember the range

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 34 / 54

Page 72: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Data types

A Matlab image are usually eitheruint8: Integers [0, 255]double: Floating point [0, 1]

Any range is possible, but imshow makes assumptionsSuppose img is a uint8 image.Convert: dblimg = double ( img ) (does not change range.What does imshow(dblimg) display?Assumed range [0, 1]; anything > 1 is treated as 1.

imshow(dblimg,[0,255]) lets you define the rangeData hiding often requires type conversion

always remember the range

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 34 / 54

Page 73: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Data types

A Matlab image are usually eitheruint8: Integers [0, 255]double: Floating point [0, 1]

Any range is possible, but imshow makes assumptionsSuppose img is a uint8 image.Convert: dblimg = double ( img ) (does not change range.What does imshow(dblimg) display?Assumed range [0, 1]; anything > 1 is treated as 1.

imshow(dblimg,[0,255]) lets you define the rangeData hiding often requires type conversion

always remember the range

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 34 / 54

Page 74: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations The image in the spatial domain

Data types

A Matlab image are usually eitheruint8: Integers [0, 255]double: Floating point [0, 1]

Any range is possible, but imshow makes assumptionsSuppose img is a uint8 image.Convert: dblimg = double ( img ) (does not change range.What does imshow(dblimg) display?Assumed range [0, 1]; anything > 1 is treated as 1.

imshow(dblimg,[0,255]) lets you define the rangeData hiding often requires type conversion

always remember the range

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 34 / 54

Page 75: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 76: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 77: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 78: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 79: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 80: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 81: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 82: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 83: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 84: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 85: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 86: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 87: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The coefficients in bits

Take a number 217.Written Base 10i.e. 217 = 7 · 100 + 1 · 101 + 2 · 102

Least significant digit: the last/the ones

Same number 21710 = 110110012

Written in Base 2110110012 = 1 ·20 +0 ·21 +0 ·22 +1 ·23 +1 ·24 +0 ·25 +1 ·26 +1 ·27

Least significant bit: the last/the ones

Any base could be used. (8 and 16 are common.)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 35 / 54

Page 88: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 89: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 90: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 91: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 92: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 93: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

The mod operator

We write m = x mod Nwhen x = y · N + m for some y and 0 ≤ m < N.

i.e. m is the remainder of x when divided by N.

Matlab: m = mod ( x, N )

What does this have to with Least Significant bits?What is the remainder when you divide by 2 (your base)?

lsb = x mod 2

You can extract k bits if you want, y = x mod 2k .And x and y may be matrices (images).

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 36 / 54

Page 94: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

Matlab Demo: image

pic = imread ( ’picfile.pnm’ )

whos pic

imshow ( pic ) ;

lsbpic = mod ( pic, 2 ) ;

figure ; imshow ( lsbpic, [ 0 1 ] ) ;

pic7bit = pic - lsbpic

figure ; imshow ( pic7bit ) ;

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 37 / 54

Page 95: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

Matlab Demo: image

pic = imread ( ’picfile.pnm’ )

whos pic

imshow ( pic ) ;

lsbpic = mod ( pic, 2 ) ;

figure ; imshow ( lsbpic, [ 0 1 ] ) ;

pic7bit = pic - lsbpic

figure ; imshow ( pic7bit ) ;

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 37 / 54

Page 96: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Numbers in Bits

Matlab Demo: image

pic = imread ( ’picfile.pnm’ )

whos pic

imshow ( pic ) ;

lsbpic = mod ( pic, 2 ) ;

figure ; imshow ( lsbpic, [ 0 1 ] ) ;

pic7bit = pic - lsbpic

figure ; imshow ( pic7bit ) ;

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 37 / 54

Page 97: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Characters in Numbers

The message

Message: Hello World!

0 1 2 3 4 5 6 7 8 9 A B C D E F0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US2 SP ! " # $ % & ’ ( ) * + , - . /3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?4 @ A B C D E F G H I J K L M N O5 P Q R S T U V W X Y Z [ \ ] ^ _6 ‘ a b c d e f g h i j k l m n o7 p q r s t u v w x y z { | } ~ DEL

H e l l o W o r l d !48 65 6C 6C 6F 20 57 6F 72 6C 64 21

100 1000 110 0101 110 1100 110 1100 110 1111 010 0000 101 0111 110 1111 111 0010 110 1100 110 0100 010 0001

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 38 / 54

Page 98: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Characters in Numbers

Message as a binary image

H e l l o W o r l d !48 65 6C 6C 6F 20 57 6F 72 6C 64 21

100 1000 110 0101 110 1100 110 1100 110 1111 010 0000 101 0111 110 1111 111 0010 110 1100 110 0100 010 0001

hello.pnm

P112 71 1 1 1 1 0 1 1 1 1 1 00 1 1 1 1 1 0 1 1 1 1 10 0 0 0 0 0 1 0 1 0 0 01 0 1 1 1 0 0 1 0 1 0 00 1 1 1 1 0 1 1 0 1 1 00 0 0 0 1 0 1 1 1 0 0 00 1 0 0 1 0 1 1 0 0 0 1

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 39 / 54

Page 99: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Image and Data representations Characters in Numbers

Matlab Demo: message

msg = ’Hello World!’

nummsg = double ( msg )

binmsg = de2bi ( nummsg, 7 )

imshow ( binmsg, [0 1] )

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 40 / 54

Page 100: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 41 / 54

Page 101: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

LSB Steganography

LSB Steganography replaces the LSB plane with message data.Using the first n pixels

Binary message: binmsgPixmap: piclsbpic = mod ( pic, 2 )

n = length ( binmsg(:) )

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 42 / 54

Page 102: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

LSB Steganography

LSB Steganography replaces the LSB plane with message data.Using the first n pixels

Binary message: binmsgPixmap: piclsbpic = mod ( pic, 2 )

n = length ( binmsg(:) )

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 42 / 54

Page 103: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

LSB Steganography

LSB Steganography replaces the LSB plane with message data.Using the first n pixels

Binary message: binmsgPixmap: piclsbpic = mod ( pic, 2 )

n = length ( binmsg(:) )

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 42 / 54

Page 104: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Matrix indexing

Dual representation in matlabExternal representation: two-dimensional n ×m

pic(i,j) refers to this representationInternal representation: one-dimensional

pic(i) refers to this representationpic(:) is all elements, in one dimension

Column vectorAll columns concatenated as one column

Matrices can be reshapedfoobar = reshape ( pic, [n/2,m*2] )One-dimensional representation does not change.

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 43 / 54

Page 105: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Matrix indexing

Dual representation in matlabExternal representation: two-dimensional n ×m

pic(i,j) refers to this representationInternal representation: one-dimensional

pic(i) refers to this representationpic(:) is all elements, in one dimension

Column vectorAll columns concatenated as one column

Matrices can be reshapedfoobar = reshape ( pic, [n/2,m*2] )One-dimensional representation does not change.

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 43 / 54

Page 106: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Matrix indexing

Dual representation in matlabExternal representation: two-dimensional n ×m

pic(i,j) refers to this representationInternal representation: one-dimensional

pic(i) refers to this representationpic(:) is all elements, in one dimension

Column vectorAll columns concatenated as one column

Matrices can be reshapedfoobar = reshape ( pic, [n/2,m*2] )One-dimensional representation does not change.

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 43 / 54

Page 107: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Matrix indexing

Dual representation in matlabExternal representation: two-dimensional n ×m

pic(i,j) refers to this representationInternal representation: one-dimensional

pic(i) refers to this representationpic(:) is all elements, in one dimension

Column vectorAll columns concatenated as one column

Matrices can be reshapedfoobar = reshape ( pic, [n/2,m*2] )One-dimensional representation does not change.

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 43 / 54

Page 108: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Matrix indexing

Dual representation in matlabExternal representation: two-dimensional n ×m

pic(i,j) refers to this representationInternal representation: one-dimensional

pic(i) refers to this representationpic(:) is all elements, in one dimension

Column vectorAll columns concatenated as one column

Matrices can be reshapedfoobar = reshape ( pic, [n/2,m*2] )One-dimensional representation does not change.

pic(1:n) = pic(1:n) - lsbpic(1:n) + binmsg(1:n)

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 43 / 54

Page 109: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Loops in Matlab

Avoid loops (for) in Matlab,There is almost always a faster way to do it.

Operations are defined on matrices

for i=1:M,for j=1:N,C(i,j) = A(i,j) + C(i,j) ;

endend

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 44 / 54

Page 110: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Basic LSB

Loops in Matlab

Avoid loops (for) in Matlab,There is almost always a faster way to do it.

Operations are defined on matrices

C = A + B ;

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 44 / 54

Page 111: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 112: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 113: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 114: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 115: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 116: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 117: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 118: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 119: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Is LSB a good idea?

Simple; easy to implementLittle distortion in the spatial domainSecurity: assumes that LSB-s are

RandomIndependent of higher-order bitsIndependent of other pixels

Several authors made this assumption independentlyIs it true?Too simple; easy to detect

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 45 / 54

Page 120: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Random locations

Basic LSB uses first n pixelsA lot of structure to fixed (known) locations

Improvement: use n pseudo-random pixelsdetermined by secret key shared by sender and receiverno structure in the choice of bits

⇒ harder to steganalysestill some structure in the changes

⇒ steganalysis is still possible

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 46 / 54

Page 121: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Random locations

Basic LSB uses first n pixelsA lot of structure to fixed (known) locations

Improvement: use n pseudo-random pixelsdetermined by secret key shared by sender and receiverno structure in the choice of bits

⇒ harder to steganalysestill some structure in the changes

⇒ steganalysis is still possible

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 46 / 54

Page 122: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Random locations

Basic LSB uses first n pixelsA lot of structure to fixed (known) locations

Improvement: use n pseudo-random pixelsdetermined by secret key shared by sender and receiverno structure in the choice of bits

⇒ harder to steganalysestill some structure in the changes

⇒ steganalysis is still possible

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 46 / 54

Page 123: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

LSB – The Simplest Stegosystem Merits and flaws

Random locations

Basic LSB uses first n pixelsA lot of structure to fixed (known) locations

Improvement: use n pseudo-random pixelsdetermined by secret key shared by sender and receiverno structure in the choice of bits

⇒ harder to steganalysestill some structure in the changes

⇒ steganalysis is still possible

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 46 / 54

Page 124: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code

Outline

1 The module

2 Steganography models

3 Intro to Matlab

4 Image and Data representations

5 LSB – The Simplest Stegosystem

6 Readable and Reusable Code

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 47 / 54

Page 125: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

What are functions?

FunctionInput Output

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 48 / 54

Page 126: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

What are functions?

FunctionInput Output

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 48 / 54

Page 127: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

What are functions?

Function

Input 1 Output 1

Input 2 Output 2

......

Input n Output m

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 48 / 54

Page 128: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

Why do we use functions?

Break down programs into smaller piecesEach piece

has a clear purposeis easy to understand

Black boxesOnce designed, we don’t care about the contentsAtomic piecesreusablecan be combined in many ways

Coursework should be made clean and tidyand that requires functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 49 / 54

Page 129: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

Why do we use functions?

Break down programs into smaller piecesEach piece

has a clear purposeis easy to understand

Black boxesOnce designed, we don’t care about the contentsAtomic piecesreusablecan be combined in many ways

Coursework should be made clean and tidyand that requires functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 49 / 54

Page 130: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

Why do we use functions?

Break down programs into smaller piecesEach piece

has a clear purposeis easy to understand

Black boxesOnce designed, we don’t care about the contentsAtomic piecesreusablecan be combined in many ways

Coursework should be made clean and tidyand that requires functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 49 / 54

Page 131: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

Why do we use functions?

Break down programs into smaller piecesEach piece

has a clear purposeis easy to understand

Black boxesOnce designed, we don’t care about the contentsAtomic piecesreusablecan be combined in many ways

Coursework should be made clean and tidyand that requires functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 49 / 54

Page 132: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

Why do we use functions?

Break down programs into smaller piecesEach piece

has a clear purposeis easy to understand

Black boxesOnce designed, we don’t care about the contentsAtomic piecesreusablecan be combined in many ways

Coursework should be made clean and tidyand that requires functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 49 / 54

Page 133: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

How do we use functions?

X = imread ( ’picfile.pnm’ )imread is a function’picfile.pnm’ is an input parameterthe function outputs an image, which you store in X

The function is defined in a file imread.mYou can open it with edit imread.mYou needn’t know where the file is stored

You can create your own functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 50 / 54

Page 134: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

How do we use functions?

X = imread ( ’picfile.pnm’ )imread is a function’picfile.pnm’ is an input parameterthe function outputs an image, which you store in X

The function is defined in a file imread.mYou can open it with edit imread.mYou needn’t know where the file is stored

You can create your own functions.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 50 / 54

Page 135: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

How do we make functions?

use any text editor (e.g. vi(1)).Matlab has a built-in editor (which I have hardly used)

name: functionname.m (e.g. lsbget.m)put in current directoryRecognised by first line:

function [out1,out2] = functionname ( in1, in2 )

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 51 / 54

Page 136: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Functions

How do we make functions?What it looks like

function [ binmsg ] = lsbget ( X, L )

% Recover a message embedded by lsbhide.

S = size ( X ) ; % Image format

if ( nargin < 2 ),% If only one parameterL = prod ( S ) ; % then set L to size of X.

end

binmsg = mod ( X(1:L), 2 ) ; % Extract LSB layer

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 52 / 54

Page 137: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Comments and Documentation

Comments and Documentation

Percentage marks identify commentstext from % to the end of the line is ignored

First block of comments is a help textdisplayed by helpshould explain the usage

First comment line is a brief descriptionused by lookfor

Other comments explains your code.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 53 / 54

Page 138: CSM25 Secure Information Hiding Dr Hans Georg SchaathunCSM25 Secure Information Hiding Dr Hans Georg Schaathun University of Surrey Spring 2009 – Week 1 ... Information hiding Information

Readable and Reusable Code Comments and Documentation

Summary

Spend time to get used to MatlabDo the ExercisesMake your own implementation of LSB embedding

Core Reading

Digital Image Processing using Matlab by Gonzalez, Woods, Eddins.Chapter 2.10.

Dr Hans Georg Schaathun Basics of Steganography Spring 2009 – Week 1 54 / 54