stego

package module
v0.0.0-...-3bcac1f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2017 License: MIT Imports: 2 Imported by: 0

README

stego

A simple package for image steganography

The repo contains a package for image steganography and main package which compiles to a command line tool for encoding and decoding messages in images

package usage

The package is well commented and most of it should be self explanatory.

It provides an interface for the distribution of data in an image called ´Scrambler´.

There are two exported function: Encode([]byte, image.Image, *Scrambler) (image.Image, error) and Decode(image.Image, *Scrambler) ([]byte, error).

Encode will encode the bytes in the image using the scrambler and return a new image.

Decode will decode the image using the scrambler and return a byte array with the decoded data

Both functions returns a StegoError if something goes wrong

Command line utility usage

Encodeing is done with stego encode <INPUT IMAGE PATH> [OUTPUT IMAGE PATH] [MESSAGE] where MESSAGE and OUTPUT IMAGE PATH are optional. If ommited, the message will be read from stdin and the resulting image will be forwarded to stdout.

Decoding are done with stego decode [INPUT IMAGE PATH] where INPUT IMAGE PATH are optional. If ommited the image to decode will be read from stdin.

Documentation

Index

Constants

View Source
const (
	SOH byte = 1 // Start of header
	STX byte = 2 // Start of text (end of header)

)

Variables

This section is empty.

Functions

func Decode

func Decode(img image.Image, scrambler Scrambler) ([]byte, error)

Decode reads bytes from a Image using a Scrambler. If it fails for some reason, an error is returned

func Encode

func Encode(bytes []byte, img image.Image, scrambler Scrambler) (image.Image, error)

Encode encodes a slice of Bytes in the Image using the Scrambler. If it fails for some reason, an error is returned.

Types

type Scrambler

type Scrambler interface {
	Init(image image.Image)
	Next() (x, y, c int)
	Cap() int
}

Scrambler is used to distribute data in an image, but an implementation should not alter the image itself.

The Init method should put the scrambler in a state from which Next should always generate the same sequence of results given the same image.

Next should return whichever pixel and colour channel that should be modified or read next. Calling next should always result in unique color coordinates (x, y and c), as long as it's not called more times than the capacity returned by Cap.

Cap should return the maximum number of times Next can be guaranteed to produce unique colour coordinates. If Init hasn't been called before Cap, Cap should return 0.

type StegoError

type StegoError string

func (StegoError) Error

func (e StegoError) Error() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL