underbyte

package module
v0.0.0-...-f0b1c69 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 14 Imported by: 0

README

underbyte

Fun with steganography, images, and Go. Encode arbitrary bytes in image pixels.

Note that encoding only writes output images as PNGs (though JPEGs can be used as an input image).

Example:

This image of Leo Tolstoy encodes an epub of the entirety of War and Peace. Leo Tolstoy It was created by running

cat war_and_peace.epub| ./underbyte -file tolstoy.jpg -out tolstoy_war_peace.png

You can decode and extract the epub file by running

./underbyte -decode -file tolstoy_war_peace.png -out decoded_war_peace.epub
Secret keys

You can supply a secret key when coding and decoding. This secret is used to seed randomized pixel cursor that determines which pixels contain which bytes of the encoded message.

Installation

Building from source
go build -o underbyte cmd/main.go

Usage

Usage of ./underbyte:
  -decode
    	Decode message from image instead of encoding (default false)
  -file string
    	Input image filepath
  -message string
    	message to encode (STDIN used if not specified)
  -out string
    	Output filepath for encoded image (STDOUT used if not specified)
  -secret string
        secret key value used to encode and decode message

Examples:
  Encoding:
	underbyte -file image.png -message "hello there" -out encoded_image.png
	underbyte -file image.png -message "hello there" > encoded_image.png
	cat somefile.txt | underbyte -file image.png > encoded_image.png
  Decoding:
  	underbyte -decode -file encoded_image.png
	underbyte -decode -file encoded_image.png -out decoded_image.png

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoublePackReader

type DoublePackReader struct {
	// contains filtered or unexported fields
}

type ImageLoader

type ImageLoader interface {
	// contains filtered or unexported methods
}

type PixelCursor

type PixelCursor struct {
	Sequence
}

func NewPixelCursor

func NewPixelCursor(max, index int) *PixelCursor

func NewRandomizedPixelCursor

func NewRandomizedPixelCursor(u UnderbyteImage, initPosition, maxIterations int) *PixelCursor

type RandomizedSequence

type RandomizedSequence struct {
	// contains filtered or unexported fields
}

type Sequence

type Sequence interface {
	// contains filtered or unexported methods
}

type SequentialSequence

type SequentialSequence struct {
	// contains filtered or unexported fields
}

type SinglePackReader

type SinglePackReader struct {
	// contains filtered or unexported fields
}

type SourceImageBytes

type SourceImageBytes []byte

type SourceImagePath

type SourceImagePath string

type UnderbyteImage

type UnderbyteImage struct {
	*image.NRGBA
	// contains filtered or unexported fields
}

func NewUnderbyteImage

func NewUnderbyteImage(source ImageLoader, options *UnderbyteOptions) *UnderbyteImage

func (*UnderbyteImage) Decode

func (u *UnderbyteImage) Decode(w io.Writer) error

func (*UnderbyteImage) Encode

func (u *UnderbyteImage) Encode(message []byte) error

func (*UnderbyteImage) WriteImage

func (u *UnderbyteImage) WriteImage(w io.Writer)

type UnderbyteOptions

type UnderbyteOptions struct {
	Randomize bool
	Secret    string
}

type UnderbyteReader

type UnderbyteReader interface {
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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