steganographyonlinecodec

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

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

Steganography Online Codec SDK for Go

Steganography Online Codec allows you to hide a password encrypted message within the images & photos using AES encryption algorithm with a 256-bit PBKDF2 derived key.

You can use it for free at:

https://www.pelock.com/products/steganography-online-codec

This SDK provides programming access to the codec and its encoding and decoding functions through a WebAPI interface.

What is steganography & how it works?

Steganography is a term describing the art and science of hiding information by embedding messages within other, seemingly harmless image files.

In this case, the individual bits of the encrypted hidden message are saved as the least significant (LSB) bits in the RGB color components in the pixels of the selected image.

Steganography Online Codec - Hide Message in Image

With our steganographic encoder you will be able to conceal any text message in the image in a secure way and send it without raising any suspicion. It will only be possible to read the message after providing valid, decryption password.

Installation

The preferred way to install the Web API SDK is via Go modules.

go get github.com/PELock/Steganography-Online-Codec-Go

The module path is github.com/PELock/Steganography-Online-Codec-Go.

Packages for other programming languages

The installation packages have been uploaded to repositories for several popular programming languages and their source codes have been published on GitHub:

Repository Language Installation Package GitHub
PyPI repository for Python Python Run pip install steganography-online-codec PyPI Sources
NPM repository for JavaScript and TypeScript JavaScript, TypeScript Run npm i steganography-online-codec or add "steganography-online-codec": "latest" under dependencies in package.json NPM Sources
Rust crates.io Rust Run cargo add steganography-online-codec or add steganography-online-codec = "1" to Cargo.toml (optional: git / path for unreleased or vendored builds) crates.io Sources
Example — decode/main.go
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Decode(context.Background(), "output_file_with_hidden_secret_message.png", "Pa$$word")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if result.Error != steganographyonlinecodec.ErrorSuccess {
		fmt.Printf("Error code %d\n", result.Error)
		os.Exit(1)
	}
	fmt.Println(result.Message)
}
Example — login/main.go
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Login(context.Background())
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Printf("error=%d demo=%v\n", result.Error, result.Demo)
}
Example — simple/main.go
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Encode(context.Background(), "input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if result.Error == steganographyonlinecodec.ErrorSuccess {
		fmt.Println("Secret message encoded and saved to the output PNG file.")
		return
	}
	fmt.Printf("Error code %d\n", result.Error)
}

See the examples/ directory in this repository for complete samples.

Got questions?

If you are interested in the Steganography Online Codec Web API or have any questions regarding SDK packages, technical or if something is not clear, please contact me. I'll be happy to answer all of your questions.

Bartosz Wójcik

Documentation

Index

Constants

View Source
const (
	APIURL = "https://www.pelock.com/api/steganography-online-codec/v1"

	ErrorWebAPIConnection   = -1
	ErrorSuccess            = 0
	ErrorUnknown            = 1
	ErrorMessageTooLong     = 2
	ErrorImageTooBig        = 3
	ErrorInvalidInput       = 4
	ErrorInvalidImageFormat = 5
	ErrorImageMalformed     = 6
	ErrorInvalidPassword    = 7
	ErrorLimitMessage       = 9
	ErrorLimitPassword      = 10
	ErrorOutputFile         = 99
	ErrorInvalidLicense     = 100
)

Variables

This section is empty.

Functions

func ConvertSize

func ConvertSize(sizeBytes float64) string

ConvertSize formats a byte count as a human-readable size.

Types

type Client

type Client struct {
	APIKey     string
	APIURL     string
	UserAgent  string
	HTTPClient *http.Client
}

Client is the Steganography Online Codec Web API client.

func New

func New(apiKey string) *Client

New creates a client. An empty or invalid key runs demo mode.

func (*Client) Decode

func (c *Client) Decode(ctx context.Context, inputImagePath, password string) (*Result, error)

Decode extracts a hidden message from an image using the given password.

func (*Client) Encode

func (c *Client) Encode(ctx context.Context, inputImagePath, messageToHide, password, outputImagePath string) (*Result, error)

Encode hides a password-protected message in an image and writes the PNG to outputImagePath.

func (*Client) Login

func (c *Client) Login(ctx context.Context) (*Result, error)

Login returns license information for the activation key.

type Result

type Result struct {
	Error        int    `json:"error"`
	EncodedImage string `json:"encodedImage,omitempty"`
	Message      string `json:"message,omitempty"`
	Demo         bool   `json:"demo,omitempty"`
}

Result is the parsed Web API JSON response.

Directories

Path Synopsis
examples
decode command
login command
simple command

Jump to

Keyboard shortcuts

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