定制 sobhanlori/steganography 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sobhanlori/steganography

Composer 安装命令:

composer require sobhanlori/steganography

包简介

Hide and extract data in images using steganography techniques.

README 文档

README

A lightweight PHP package for hiding and retrieving secret messages inside PNG images using steganography.

Features

  • Hide text messages inside images
  • Extract hidden messages from encoded images
  • Simple and fluent API
  • No external dependencies required

Installation

Install the package via Composer:

composer require sobhanlori/steganography

Requirements

  • PHP 8.1+
  • GD extension enabled

Usage

Hide Data Inside an Image

<?php

use Sobhanlori\Steganography\Steganography;

$steganography = new Steganography();

$steganography
    ->conceal('example.png', 'This is hidden text!')
    ->save('example-secret.png');

Download Encoded Image

If you're using the package in a web application, you can directly send the generated image to the browser:

<?php

use Sobhanlori\Steganography\Steganography;

$steganography = new Steganography();

$steganography
    ->conceal('example.png', 'This is hidden text!')
    ->download('example-secret.png');

Retrieve Hidden Data

<?php

use Sobhanlori\Steganography\Steganography;

$steganography = new Steganography();

$data = $steganography->reveal('example-secret.png');

echo $data;

How It Works

The package uses image steganography techniques to embed data within image pixels. The visual appearance of the image remains nearly identical to the original while containing hidden information that can later be extracted.

Limitations

Image Format

Currently, all generated output images are saved as PNG files.

$steganography
    ->conceal('image.png', 'Secret Message')
    ->save('output.png');

Using PNG ensures that hidden data is preserved because PNG is a lossless image format.

Supported Characters

At the moment, hidden messages can contain:

  • English alphabet characters (A-Z, a-z)
  • Numbers (0-9)
  • Common symbols and punctuation

Unicode and non-English characters are not currently supported.

Examples of supported text:

Hello World!
User123
[email@example.com]
Secret Message #1

Example

<?php

require 'vendor/autoload.php';

use Sobhanlori\Steganography\Steganography;

$steganography = new Steganography();

// Hide data
$steganography
    ->conceal('photo.png', 'My Secret Message')
    ->save('photo-secret.png');

// Reveal data
$message = $steganography->reveal('photo-secret.png');

echo $message; // My Secret Message

Contributing

Contributions are welcome.

Running Tests

composer test

Before submitting a pull request, please ensure all tests pass successfully.

Security Notes

Steganography hides the existence of data but does not encrypt it.

For sensitive information, consider encrypting your message before embedding it into an image.

License

The MIT License (MIT).

See the LICENSE file for more information.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-07