ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - auyer/steganography: Pure Golang Library that allows LSB steganography on images using ZERO dependencies
Pure Golang Library that allows LSB steganography on images using ZERO dependencies - auyer/steganography
Visit Site

GitHub - auyer/steganography: Pure Golang Library that allows LSB steganography on images using ZERO dependencies

GitHub - auyer/steganography: Pure Golang Library that allows LSB steganography on images using ZERO dependencies

Steganography Lib

GoDoc Go Report Card LICENSE MIT Actions CI codecov Mentioned in Awesome Go

Steganography is a library written in Pure go to allow simple LSB steganography on images. It is capable of both encoding and decoding images. It can store files of any format. This library is inspired by Stego by EthanWelsh, a command line utility with the same purpose.

Installation

go get -u github.com/auyer/steganography

Demonstration

Original Encoded
Original File Encoded File

The second image contains the first paragraph of the description of a stegosaurus on Wikipedia, also available in examples/message.txt as an example.


Getting Started

package main
import (
    "bufio"
    "image/png"
    "io/ioutil"

    "github.com/auyer/steganography"
)

Encode

Write mode is used to take a message and embed it into an image file using LSB steganography in order to produce a secret image file that will contain your message.

Note that the minimum image size is 24 pixels for one byte. For each additional byte, it is necessary 3 more pixels.

inFile, _ := os.Open("input_file.png") // opening file
reader := bufio.NewReader(inFile)   // buffer reader 
img, _ := png.Decode(reader)   // decoding to golang's image.Image

w := new(bytes.Buffer)   // buffer that will recieve the results
err := steganography.Encode(w, img, []byte("message")) // Encode the message into the image
if err != nil {
    log.Printf("Error Encoding file %v", err)
    return
}
outFile, _ := os.Create("out_file.png") // create file
w.WriteTo(outFile) // write buffer to it
outFile.Close()

note: all error checks were removed for brevity, but they should be included.

Size of Message

Length mode can be used in order to preform a preliminary check on the carrier image in order to deduce how large of a file it can store.

sizeOfMessage := steganography.GetMessageSizeFromImage(img) // retrieves the size of the encoded message

Decode

Read mode is used to read an image that has been encoded using LSB steganography, and extract the hidden message from that image.

inFile, _ := os.Open(encodedInputFile) // opening file
defer inFile.Close()

reader := bufio.NewReader(inFile) // buffer reader 
img, _ := png.Decode(reader) // decoding to golang's image.Image

sizeOfMessage := steganography.GetMessageSizeFromImage(img) // retrieving message size to decode in the next line

msg := steganography.Decode(sizeOfMessage, img) // decoding the message from the file
fmt.Println(string(msg))

note: all error checks were removed for brevity, but they should be included.

Complete Example

For a complete example, see the examples/stego.go file. It is a command line app based on the original fork of this repository, but modified to use the Steganography library.


Attributions

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory