Steganography Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See

Slides:



Advertisements
Similar presentations
Interfaces Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Advertisements

Tuples Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Images Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
What is Steganography? def’n: the art and science of hiding information by embedding it in some other data. cryptography - render message unintelligible.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae & david streader, VUW Images and 2D Graphics COMP.
Introduction to Multimedia SMDC Staff Training 6/9/06.
SWE 423: Multimedia Systems Chapter 7: Data Compression (2)
Steganography Rayan Ghamri.
Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.
Part A Multimedia Production Rico Yu. Part A Multimedia Production Ch.1 Text Ch.2 Graphics Ch.3 Sound Ch.4 Animations Ch.5 Video.
An Introduction to Scanning and Storing Photographs and Graphics Bryn Jones Aug 2002
CS110: Computers and the Internet Color and Image Representation.
Data starts with width and height of image Then an array of pixel values (colors) The number of elements in this array is width times height Colors can.
Understanding Web Graphics Web Design Section 5-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Exploring Steganography: Seeing the Unseen Neil F. Johnson Sushil Jajodia George Mason University.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Images and 2D Graphics COMP # 16.
CS559-Computer Graphics Copyright Stephen Chenney Image File Formats How big is the image? –All files in some way store width and height How is the image.
Core Issues in Digital Preservation: Text and Images Jacob Nadal, Preservation Officer UCLA Library.
Steganography detection Roland Cmorik, Martin Šumák.
Color Names All standards-compliant browsers should handle these color names These color names can be used with the CSS properties of color and background-color.
Functions Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Digital Image: Representation & Processing (2/2) Lecture-3
© Keith Vander Linden, 2005 Jeremy D. Frens, Open up the box of a computer, and you won't find any numbers in there. You'll find electromagnetic.
Have you ever wanted to hide something from: Your friends? Your family? The Government?
Fixtures Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
1 Analysis of Algorithms Chapter - 08 Data Compression.
Compsci 06/101, Fall Steganography l Hide text in image (or hide information in image)  Why might we do this?  Difference: watermarking v steganography.
Understanding Images on the Computer How do images work and why?
Web Image Basics Comp 140 December 2. Vector Graphics Can be repositioned or resized – Will not diminish output quality Typically stored in AI, EPS, PICT.
Image Representation. Objectives  Bitmaps: resolution, colour depth and simple bitmap file calculations.  Vector graphics: drawing list – objects and.
© Keith Vander Linden, 2005 Jeremy D. Frens, Open up the box of a computer, and you won't find any numbers in there. You'll find electromagnetic.
Invasion Percolation: Assembly Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Computer Images Can store color info about each pixel, but makes file BIG Compression for Web 15.
File Formats and Vector Graphics. File Types Images and data are stored in files. Each software application uses different native file types and file.
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Interface and Implementation Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Implementation of Least Significant Bit Image Steganography and its Steganalaysis By: Deniz Oran Fourth Quarter.
Storage Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Adobe Dreamweaver CC: The Professional Portfolio Project 3: Photographer’s Web Site Working with static images Controlling backgrounds with CSS Working.
Images. Digital Images Rectangular arrays of pixel data Pixel - picture element, smallest addressable part of the frame buffer. Color depth - the depth.
Raster Graphics 2.01 Investigate graphic image design.
Text Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
POWERPOINT PLUS 11/17/07 Class Notes. WHAT IS A PIXEL A pixel is a number that represents the intensity of light at a square spot in the picture. Pixels.
Cryptographic Anonymity Project Alan Le
Digital Graphics for Computer Games Pixels Types of Digital Graphics (Raster and Vector) Compression.
Image Operations Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Exceptions Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Image File Formats Harrow Computer Club – Wed, 1 Dec 2010 Bob Watson MA CMath MIMA MBCS.
WEB GRAPHICS EXPLORING COMPUTER SCIENCE - LESSON 3-4.
Counting Stars Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
2D drawing basics For CSE 3902 By: Matt Boggus. Overview 2D coordinate systems Raster images Sprite drawing in XNA.
Implementation of Least Significant Bit Image Steganography and its Steganalaysis By: Deniz Oran Third Quarter.
Information Systems Design and Development Media Types Computing Science.
Common Bitmap Image File Types
File Compression 3.3.
CSI-447: Multimedia Systems
Sets and Dictionaries Examples Copyright © Software Carpentry 2010
Steganography Example
1.01 Investigate graphic types and file formats.
2.01 Investigate graphic image design.
JPG vs GIF vs PNG What is the difference?
Raster Images CPSC 1030.
2D Drawing Basics 1.
Representing Images 2.6 – Data Representation.
2.01 Investigate graphic image design.
functions: argument, return value
Program Design Invasion Percolation: The Grid
2.01 Investigate graphic image design.
2.01 Investigate graphic image design.
STEGANOGRAPHY IN IMAGES
Presentation transcript:

Steganography Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information. Multimedia Programming

Steganography Data is 1's and 0's

Multimedia ProgrammingSteganography Data is 1's and 0's Normally think of them as integers, characters, etc.

Multimedia ProgrammingSteganography Data is 1's and 0's Normally think of them as integers, characters, etc. But sometimes useful to go back to the bits

Multimedia ProgrammingSteganography Data is 1's and 0's Normally think of them as integers, characters, etc. But sometimes useful to go back to the bits Example: hide messages in images

Multimedia ProgrammingSteganography Data is 1's and 0's Normally think of them as integers, characters, etc. But sometimes useful to go back to the bits Example: hide messages in images Steganography

Multimedia ProgrammingSteganography

Multimedia ProgrammingSteganography (53, 64, 22)

Multimedia ProgrammingSteganography (53, 64, 22) 8 bits each

Multimedia ProgrammingSteganography (53, 64, 22) 8 bits each …

Multimedia ProgrammingSteganography (53, 64, 22) 8 bits each Replace color bytes with character bytes …

Multimedia ProgrammingSteganography Main driver if sys.argv[1] == '-e': message = sys.argv[2] pic = Image.open(sys.argv[3]) encode(message, pic) pic.save(sys.argv[4]) elif sys.argv[1] == '-d': pic = Image.open(sys.argv[2]) message = decode(pic) print message

Multimedia ProgrammingSteganography Main driver if sys.argv[1] == '-e': message = sys.argv[2] pic = Image.open(sys.argv[3]) encode(message, pic) pic.save(sys.argv[4]) elif sys.argv[1] == '-d': pic = Image.open(sys.argv[2]) message = decode(pic) print message $ steg –e 'ABCDEF' in.jpg out.jpg

Multimedia ProgrammingSteganography Main driver if sys.argv[1] == '-e': message = sys.argv[2] pic = Image.open(sys.argv[3]) encode(message, pic) pic.save(sys.argv[4]) elif sys.argv[1] == '-d': pic = Image.open(sys.argv[2]) message = decode(pic) print message $ steg –d out.jpg

Multimedia ProgrammingSteganography Main driver if sys.argv[1] == '-e': message = sys.argv[2] pic = Image.open(sys.argv[3]) encode(message, pic) pic.save(sys.argv[4]) elif sys.argv[1] == '-d': pic = Image.open(sys.argv[2]) message = decode(pic) print message

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1 def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b))

Multimedia ProgrammingSteganography Encode def encode(message, pic): assert len(message) < 256, 'Message is too long' set_red(pic, 0, 0, len(message)) i = 1 for c in message: set_red(pic, 0, i, ord(c)) i += 1 def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b))

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message Why not str?

Multimedia ProgrammingSteganography Decode def decode(pic): num_chars = get_red(pic, 0, 0) message = '' for i in range(1, num_chars+1): message += chr(get_red(pic, 0, i)) i += 1 return message def get_red(pic, x, y): r, g, b = pic.getpixel((x, y)) return r

Multimedia ProgrammingSteganography Result 'ABCDEF'

Multimedia ProgrammingSteganography Result 'ABCDEF'

Multimedia ProgrammingSteganography Result 'ABCDEF'

Multimedia ProgrammingSteganography Result 'ABCDEF'

Multimedia ProgrammingSteganography Result 'ABCDEF'

Multimedia ProgrammingSteganography Result ? 'ABCDEF'

Multimedia ProgrammingSteganography JPEG is a lossy format

Multimedia ProgrammingSteganography JPEG is a lossy format Throw away some information to improve compression

Multimedia ProgrammingSteganography JPEG is a lossy format Throw away some information to improve compression Human eye can't tell the difference…

Multimedia ProgrammingSteganography JPEG is a lossy format Throw away some information to improve compression Human eye can't tell the difference… …but uncompressed image is not identical to original

Multimedia ProgrammingSteganography JPEG is a lossy format Throw away some information to improve compression Human eye can't tell the difference… …but uncompressed image is not identical to original Not very good for hiding messages…

Multimedia ProgrammingSteganography JPEG is a lossy format Throw away some information to improve compression Human eye can't tell the difference… …but uncompressed image is not identical to original Not very good for hiding messages… Use a lossless format like PNG instead

Multimedia ProgrammingSteganography Try program on a square white PNG

Multimedia ProgrammingSteganography Try program on a square white PNG $ steg -e 'ABCDEF' white.png encoded.png ValueError: too many values to unpack

Multimedia ProgrammingSteganography Try program on a square white PNG $ steg -e 'ABCDEF' white.png encoded.png ValueError: too many values to unpack def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b))

Multimedia ProgrammingSteganography Try program on a square white PNG $ steg -e 'ABCDEF' white.png encoded.png ValueError: too many values to unpack def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b)) Pixel at (0, 0) is (255, 255, 255, 255)

Multimedia ProgrammingSteganography Try program on a square white PNG $ steg -e 'ABCDEF' white.png encoded.png ValueError: too many values to unpack def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b)) Pixel at (0, 0) is (255, 255, 255, 255) alpha (transparency)

Multimedia ProgrammingSteganography Try program on a square white PNG $ steg -e 'ABCDEF' white.png encoded.png ValueError: too many values to unpack def set_red(pic, x, y, val): r, g, b = pic.getpixel((x, y)) pic.putpixel((x, y), (val, g, b)) Pixel at (0, 0) is (255, 255, 255, 255) Easy to fix… alpha (transparency)

Multimedia ProgrammingSteganography Result size (6) characters 'ABCDEF'

Multimedia ProgrammingSteganography Result size (6) characters Not very well hidden… 'ABCDEF'

Multimedia ProgrammingSteganography Solution: only use the least significant bit of the color in each pixel

Multimedia ProgrammingSteganography Solution: only use the least significant bit of the color in each pixel Human eye cannot see difference between (140, 37, 200) and (141, 36, 201)

Multimedia ProgrammingSteganography Solution: only use the least significant bit of the color in each pixel Human eye cannot see difference between (140, 37, 200) and (141, 36, 201) 'A' = =

Multimedia ProgrammingSteganography Solution: only use the least significant bit of the color in each pixel Human eye cannot see difference between (140, 37, 200) and (141, 36, 201) 'A' = = (8 bits/character) / (3 bytes/pixel) = 3 pixels/character

Multimedia ProgrammingSteganography Solution: only use the least significant bit of the color in each pixel Human eye cannot see difference between (140, 37, 200) and (141, 36, 201) 'A' = = (8 bits/character) / (3 bytes/pixel) = 3 pixels/character (With one bit unused)

Multimedia ProgrammingSteganography Extract bits def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits char'A' num65 10 = result[1,0,0,0,0,0,0,0] i0 def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits char'A' num32 10 = result[1,0,0,0,0,0,0,0] i1 def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits char'A' num16 10 = result[1,0,0,0,0,0,0,0] i2 def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Extract bits char'A' num1 10 = result[1,0,0,0,0,0,1,0] i6 def get_bits(char): num = ord(char) result = [0] * 8 for i in range(8): if (num % 2) != 0: result[i] = 1 num /= 2 return result

Multimedia ProgrammingSteganography Combine with pixels def combine(pixel, bits): assert len(pixel) == len(bits), 'Length mismatch' pixel = list(pixel) for i in range(len(pixel)): even = 2 * (pixel[i] / 2) if bits[i]: even += 1 pixel[i] = even return tuple(pixel)

Multimedia ProgrammingSteganography Combine with pixels def combine(pixel, bits): assert len(pixel) == len(bits), 'Length mismatch' pixel = list(pixel) for i in range(len(pixel)): even = 2 * (pixel[i] / 2) if bits[i]: even += 1 pixel[i] = even return tuple(pixel)

Multimedia ProgrammingSteganography Combine with pixels def combine(pixel, bits): assert len(pixel) == len(bits), 'Length mismatch' pixel = list(pixel) for i in range(len(pixel)): even = 2 * (pixel[i] / 2) if bits[i]: even += 1 pixel[i] = even return tuple(pixel)

Multimedia ProgrammingSteganography Combine with pixels def combine(pixel, bits): assert len(pixel) == len(bits), 'Length mismatch' pixel = list(pixel) for i in range(len(pixel)): even = 2 * (pixel[i] / 2) if bits[i]: even += 1 pixel[i] = even return tuple(pixel)

Multimedia ProgrammingSteganography Test for (p, b) in ((( 0, 0, 0), (0, 1, 0)), (( 1, 1, 1), (1, 0, 1)), (( 2, 2, 2), (1, 0, 1)), ((255, 255, 255), (0, 1, 1))): result = combine(p, b) print p, '+', b, '=>', result (0, 0, 0) + (0, 1, 0) => (0, 1, 0) (1, 1, 1) + (1, 0, 1) => (1, 0, 1) (2, 2, 2) + (1, 0, 1) => (3, 2, 3) (255, 255, 255) + (0, 1, 1) => (254, 255, 255)

Multimedia ProgrammingSteganography Write the other functions

Multimedia ProgrammingSteganography Write the other functions Most important message: bits don't mean anything

Multimedia ProgrammingSteganography Write the other functions Most important message: bits don't mean anything Meaning comes from how we act on them

November 2010 created by Greg Wilson Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information.