steg

package module
v0.0.0-...-8c637cd Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 15 Imported by: 0

README

steg

GoDoc

A full-featured steganography toolkit.

It's currently a work-in-progress, and it's operation is still subject to change.

Using it as a package

To include it in a project, simply use:

import "github.com/zedseven/steg"

Then in code, simply use the steg.Hide() and steg.Dig() methods. See the GoDoc manual for documentation.

Using it as a standalone tool

To build and use the executable (from the project base directory):

go install ./cmd/steg
Running the installed executable

Hiding data in images:

steg hide -img="<path to host image>" -file="<path to file to hide>" -pattern="<path to unique file>" -out="<path to output file to>"

Extracting data from images:

steg dig -img="<path to host image>" -pattern="<path to unique file (same as used when hiding)>" -out="<path to output file to>"

Documentation

Overview

Package steg provides a complete steganography toolkit for storage and retrieval of data within images.

Index

Constants

View Source
const (

	// VersionMax is the primary version component of the package.
	VersionMax uint8 = 0
	// VersionMid is the secondary version component of the package.
	VersionMid uint8 = 9
	// VersionMin is the tertiary version component of the package.
	VersionMin uint8 = 0
)

Variables

This section is empty.

Functions

func Dig

func Dig(config *DigConfig, outputLevel OutputLevel) error

Dig extracts the binary data of a file from a provided image on disk, and saves the result to a new file. The configuration must perfectly match the one used in encoding in order to extract successfully.

func Hide

func Hide(config *HideConfig, outputLevel OutputLevel) error

Hide hides the binary data of a file in a provided image on disk, and saves the result to a new image. It has the option of using one of several different encoding algorithms, depending on user needs.

func Version

func Version() string

Version returns the library version in a pretty string format. Format (0-padded 2-digit): Max.Mid.Min

Types

type BadHeaderError

type BadHeaderError struct{}

BadHeaderError is thrown when the read header is garbage. Likely caused by a bad configuration or source image.

func (*BadHeaderError) Error

func (e *BadHeaderError) Error() string

Error returns a string that explains the BadHeaderError.

type DigConfig

type DigConfig struct {
	// ImagePath is the path on disk to a supported image.
	ImagePath string
	// OutPath is the path on disk to write the output image.
	OutPath string
	// PatternPath is the path on disk to the pattern file used in decoding.
	PatternPath string
	// Algorithm is the algorithm to use in the operation.
	Algorithm algos.Algo
	// MaxCorrectableErrors is the number of bit errors to be able to correct for per file chunk. Setting it to 0 disables bit ECC.
	MaxCorrectableErrors uint8
	// MaxBitsPerChannel is the maximum number of bits to write per pixel channel.
	// The minimum of this and the supported max of the image format is used.
	MaxBitsPerChannel uint8
	// DecodeAlpha is whether or not to decode the alpha channel.
	DecodeAlpha bool
	// DecodeMsb is whether to decode the most-significant bits instead - mostly for debugging.
	DecodeMsb bool
}

DigConfig stores the configuration options for the Dig operation.

type HideConfig

type HideConfig struct {
	// ImagePath is the path on disk to a supported image.
	ImagePath string
	// FilePath is the path on disk to the file to hide.
	FilePath string
	// OutPath is the path on disk to write the output image.
	OutPath string
	// PatternPath is the path on disk to the pattern file used in encoding.
	PatternPath string
	// Algorithm is the algorithm to use in the operation.
	Algorithm algos.Algo
	// MaxCorrectableErrors is the number of bit errors to be able to correct for per file chunk. Setting it to 0 disables bit ECC.
	MaxCorrectableErrors uint8
	// MaxBitsPerChannel is the maximum number of bits to write per pixel channel.
	// The minimum of this and the supported max of the image format is used.
	MaxBitsPerChannel uint8
	// DecodeAlpha is whether or not to encode the alpha channel.
	EncodeAlpha bool
	// EncodeMsb is whether to encode the most-significant bits instead - mostly for debugging.
	EncodeMsb bool
}

HideConfig stores the configuration options for the Hide operation.

type InsufficientHidingSpotsError

type InsufficientHidingSpotsError struct {
	// Additional information about the problem.
	AdditionalInfo string
	// An inner error involved in the issue to provide more information.
	InnerError error
}

InsufficientHidingSpotsError is thrown when the provided image does not have enough room to hide the provided file using the provided configuration.

func (*InsufficientHidingSpotsError) Error

Error returns a string that explains the InsufficientHidingSpotsError.

type InvalidFormatError

type InvalidFormatError struct {
	// A description of the problem. If empty, a default message is used.
	ErrorDesc string
}

InvalidFormatError is thrown when provided data is of an invalid format.

func (InvalidFormatError) Error

func (e InvalidFormatError) Error() string

Error returns a string that explains the InvalidFormatError.

type OutputLevel

type OutputLevel int

OutputLevel is used to define the levels of output supported by the package.

const (
	// OutputNothing tells the package to be completely quiet.
	OutputNothing OutputLevel = iota
	// OutputSteps tells the package to print operation progress at each significant step of the process.
	OutputSteps OutputLevel = iota
	// OutputInfo tells the package to print operation progress at each significant step of the process, and include additional information.
	OutputInfo OutputLevel = iota
	// OutputDebug tells the package to print formatted debug information in addition to everything else.
	OutputDebug OutputLevel = iota
)

Directories

Path Synopsis
cmd
internal
algos
Package algos implements the set of supported algorithms for the package github.com/zedseven/steg.
Package algos implements the set of supported algorithms for the package github.com/zedseven/steg.
util
Package util provides some basic utility functions.
Package util provides some basic utility functions.

Jump to

Keyboard shortcuts

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