imcode

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

README

Imcode

Encode your data into a PNG.

In short

The tool receives data and a cypher PNG image and then encodes that data into the given PNG:

It can then decode the data back using the encoded image and the original cypher.

Due to lossless compression of the PNG format, data is also compressed when encoded.

Usage

Imcode can be used as a binary package:

# encode data with cypher and save from stdout
./imcode --from path/to/data.txt --cypher path/to/cypher.png > path/to/encoded.png

# read encoded result from stdin and restore the original data
cat path/to/encoded.png | ./imcode --from=- --cypher path/to/cypher.png --to path/to/result.txt --decode

It can also be imported and used as a Go package:

package main

import (
	"os"

	"github.com/vlad-pbr/imcode/src/codec"
)

func main() {

	// open data to encode
	data, err := os.Open("path/to/data.txt")
	if err != nil {
		panic(err)
	}
	defer data.Close()

	// open cypher png
	cypher, err := os.Open("path/to/cypher.png")
	if err != nil {
		panic(err)
	}
	defer cypher.Close()

	// create destination file
	out, err := os.Create("path/to/encoded.png")
	if err != nil {
		panic(err)
	}
	defer out.Close()

	// encode
	if err := codec.Encode(data, cypher, out); err != nil {
		panic(err)
	}
}

Compile from source

Clone this repository, cd to cloned directory, git checkout to a release tag and build:

go build -ldflags="-X 'main.VERSION=$(git describe --tags)'"

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
src
cli

Jump to

Keyboard shortcuts

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