{"id":19189917,"url":"https://github.com/charles-m-knox/steganographics","last_synced_at":"2026-06-22T22:30:15.387Z","repository":{"id":256292778,"uuid":"854854631","full_name":"charles-m-knox/steganographics","owner":"charles-m-knox","description":"A CLI tool and library to enable easy access to steganography.","archived":false,"fork":false,"pushed_at":"2024-09-09T22:34:53.000Z","size":554,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T06:28:51.589Z","etag":null,"topics":["cli","go","golang","server","steganography"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charles-m-knox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-09T22:14:00.000Z","updated_at":"2024-09-09T22:34:56.000Z","dependencies_parsed_at":"2024-09-10T03:20:09.553Z","dependency_job_id":null,"html_url":"https://github.com/charles-m-knox/steganographics","commit_stats":null,"previous_names":["charles-m-knox/steganographics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charles-m-knox%2Fsteganographics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charles-m-knox%2Fsteganographics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charles-m-knox%2Fsteganographics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charles-m-knox%2Fsteganographics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charles-m-knox","download_url":"https://codeload.github.com/charles-m-knox/steganographics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240266854,"owners_count":19774075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","go","golang","server","steganography"],"created_at":"2024-11-09T11:32:17.691Z","updated_at":"2026-06-22T22:30:15.312Z","avatar_url":"https://github.com/charles-m-knox.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# steganographics\n\nA tool to enable easy access to steganography by embedding secret text in PNG images.\n\nIt uses a simple Least Significant Bit (LSB) algorithm to distribute the desired secret bytes across the first bytes in the red channel of an image.\n\n## Usage\n\nThis program has three modes of operation - in all three modes, this project has no dependencies, it just uses standard library:\n\n- as a Go library that you can import\n- command line tool\n- a standalone HTTP server\n\n### Go library\n\nThis Go library has no dependencies aside from the standard library, and will work with `CGO_ENABLED=0`.\n\n```bash\ngo get -v github.com/charles-m-knox/steganographics/pkg/steganographics\n```\n\nUsage:\n\n```go\npackage main\n\nimport (\n    s \"github.com/charles-m-knox/steganographics/pkg/steganographics\"\n)\n\nfunc getTextFromStdin() {\n    img, _, err := image.Decode(os.Stdin)\n    if err != nil {\n        log.Fatalf(\"failed to read img from stdin: %v\", err.Error())\n    }\n\n    os.Stdout.Write(s.ExtractTextFromImage(img))\n}\n\nfunc writeTextToImageFromStdin(hiddenText string) {\n    img, _, err := image.Decode(os.Stdin)\n    if err != nil {\n        log.Fatalf(\"failed to read img from stdin: %v\", err.Error())\n    }\n\n    output, err := s.HideTextInImage(img, []byte(hiddenText))\n    if err != nil {\n        log.Fatalf(\"failed to read img from stdin: %v\", err.Error())\n    }\n\n    err = png.Encode(os.Stdout, output)\n    if err != nil {\n        log.Fatalf(\"failed to write img to stdout: %v\", err.Error())\n    }\n}\n```\n\n### Command line tool\n\nIf you want to use Go's `go install` to install steganographics, you can do it by trimming the `pkg/steganographics` suffix from the earlier `go get` command:\n\n```bash\ngo install github.com/charles-m-knox/steganographics\n```\n\nOnce installed, `steganographics` supports piping from `stdin` and to `stdout`:\n\n```bash\n# writes secret text to an image, and then immediately echoes the secret\n# text from it\ncat path/to/image.png | ./steganographics -secret \"secret message1\" | ./steganographics\n```\n\nIt can also directly read and write to/from files:\n\n```bash\n# write a message into an image:\n./steganographics -input path/to/image.png -output path/to/output.png -secret \"secret message2\"\n\n# read a message from an image:\n./steganographics -input path/to/image.png\n```\n\n### HTTP server API\n\n```bash\n./steganographics -addr \"0.0.0.0:29104\"\n\n# with tls:\nmake gen-tls-certs # optional - generates certs and requires interactive input\n./steganographics -addr \"0.0.0.0:29104\" -cert cert.pem -key key.pem\n```\n\nWhen running as an HTTP server, this program provides two REST API endpoints:\n\n1. `/api/hide`: Accepts a POST request with a JSON payload containing a `msg` field with the text to hide, and a `png` field with the Base64-encoded PNG image data. The endpoint hides the text in the image using the LSB technique and returns the modified PNG image.\n\n2. `/api/extract`: Accepts a POST request with a JSON payload containing a `png` field with the Base64-encoded PNG image data. The endpoint extracts the hidden text from the image using the LSB technique and returns a JSON response with the extracted text in a `msg` field.\n\nTo test the endpoints, you can use an HTTP client like `curl` or a tool like Postman to send POST requests with the appropriate JSON payload to the `/api/hide` and `/api/extract` endpoints.\n\n## Disclaimers and warnings\n\n- This may not be the most secure/private/hardened method of encoding text in an image.\n- This is a side project and may have bugs or other issues.\n- This project is licensed AGPL3 so you cannot use it unless you abide by the license terms.\n- Unit tests are not currently implemented, but the library does work as expected in intended, normal use cases.\n- This library may alter your source image in more ways than simply the LSB algorithm.\n- Compression or other image alterations run the risk of wiping out the embedded image.\n\n## Appendix\n\nThis is a useful command using ImageMagick's `convert` command line tool to convert a jpg to png:\n\n```bash\n# note: as of imagemagick v7, it might now called \"magick\" instead of \"convert\"\n# on your system\nconvert -quality 100 -define png:compression-level=9 input.jpg input.png\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharles-m-knox%2Fsteganographics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharles-m-knox%2Fsteganographics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharles-m-knox%2Fsteganographics/lists"}