Back to godoc.org
github.com/auyer/steganography

package steganography

v1.0.0
Latest Go to latest
Published: Jan 31, 2020 | License: MIT | Module: github.com/auyer/steganography

Overview

Package steganography is a library that provides functions to execute steganography encoding and decoding in a given image. It is also able to check the maximum encoding size, and the size of an encoded message.

Index

func Decode

func Decode(msgLen uint32, pictureInputFile image.Image) (message []byte)

Decode gets messages from pictures using LSB steganography, decode the message from the picture and return it as a sequence of bytes It wraps EncodeRGBA making the conversion from image.Image to image.RGBA

Input:
	msgLen uint32 : size of the message to be decoded
	pictureInputFile image.Image : image data used in decoding
Output:
	message []byte decoded from image

func Encode

func Encode(writeBuffer *bytes.Buffer, pictureInputFile image.Image, message []byte) error

Encode encodes a given string into the input image using least significant bit encryption (LSB steganography) The minnimum image size is 23 pixels It wraps EncodeRGBA making the conversion from image.Image to image.RGBA

Input:
	writeBuffer *bytes.Buffer : the destination of the encoded image bytes
	message []byte : byte slice of the message to be encoded
	pictureInputFile image.Image : image data used in encoding
Output:
	bytes buffer ( io.writter ) to create file, or send data.

func EncodeRGBA

func EncodeRGBA(writeBuffer *bytes.Buffer, rgbImage *image.RGBA, message []byte) error

EncodeRGBA encodes a given string into the input image using least significant bit encryption (LSB steganography) The minnimum image size is 24 pixels for one byte. For each additional byte, it is necessary 3 more pixels.

Input:
	writeBuffer *bytes.Buffer : the destination of the encoded image bytes
	pictureInputFile image.RGBA : image data used in encoding
	message []byte : byte slice of the message to be encoded
Output:
	bytes buffer ( io.writter ) to create file, or send data.

func GetMessageSizeFromImage

func GetMessageSizeFromImage(pictureInputFile image.Image) (size uint32)

GetMessageSizeFromImage gets the size of the message from the first four bytes encoded in the image

func MaxEncodeSize

func MaxEncodeSize(img image.Image) uint32

MaxEncodeSize given an image will find how many bytes can be stored in that image using least significant bit encoding ((width * height * 3) / 8 ) - 4 The result must be at least 4,

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier