viraladmin/encrypted_images_php
Composer 安装命令:
composer require viraladmin/encrypted_images_php
包简介
Encrypted Images PHP is a PHP library designed for encrypting text into images and decrypting images back into text.
关键字:
README 文档
README
Author: Bruce Bates
Copyright: 2023
X: @thebrucebates
Website: https://encryptedimages.art
License
Encrypted Images PHP is distributed under the MIT License.
Installation
composer require viraladmin/encrypted_images_php
Table of Contents
Introduction
Encrypted Images PHP is a PHP library designed for encrypting text into images and decrypting images back into text.
Supported Characters
The library supports the following characters:
- Lowercase letters (a-z)
- Uppercase letters (A-Z)
- Equal sign (=)
- Backslash ()
- Plus sign (+)
Please note that space (" ") is not included in the supported characters.
Min and Max Characters
- Minimum Characters: 10
- Maximum Characters: 5,006,512 (memory exhaustion)
- Please note that memory exhaustion may occur much earlier when converting encrypted text to images.
Security
This library is secure (as much as php can be) against encryption timing attacks.
Watermarks
Encrypted Images PHP supports various watermarks that you can embed into the images. You can choose from the following watermark types:
- Ethereum
- Bitcoin
- Cardano
- None
Functions
Text Encryption
Encrypt a string using AES-128-CBC encryption and verify integrity to protect against timing attacks.
Parameters:
$str(string): The input string to be encrypted.$key(string, optional): The encryption key. Default is "welovenfts".
Returns:
- (string|false): The encrypted string or false if encryption fails or integrity check fails.
Example Usage:
require_once 'vendor/autoload.php'; use encrypted_images_php\encryption\text; // Initialize the class $textEncryptor = new text(); // Encrypt a string $encryptedString = $textEncryptor->encrypt("Your secret message", 'encryption-key'); // Check if encryption was successful if ($encryptedString !== false) { // Proceed with the encrypted data } else { // Handle the encryption failure }
Image Encryption
Encrypt a string and embed it into an image with a watermark.
Parameters:
$str(string): The input string to be encrypted.$watermark(string, optional): The watermark type (e.g., 'ethereum', 'bitcoin', 'cardano').$key(string, optional): The encryption key. Default is "welovenfts".$r(int, optional): Top gradient adjustment.$g(int, optional): Middle gradient adjustment.$b(int, optional): Bottom gradient adjustment.
Returns:
- (string): Base64-encoded image containing the encrypted data.
Example Usage:
require_once 'vendor/autoload.php'; use encrypted_images_php\encryption\images; // Initialize the class $imageEncryptor = new images(); // Encrypt a string and embed it into an image with a watermark $imageData = $imageEncryptor->encryptToImage("Your secret message", 'ethereum', 'encryption-key', 100, 134, 131); // Display or use the base64-encoded image data as needed echo '<img src="data:image/png;base64,' . $imageData . '" alt="Encrypted Image" />';
Text Decryption
Decrypt an encrypted text and return the original plaintext.
Parameters:
$text(string): The encrypted text to be decrypted.$key(string, optional): The decryption key. Default is "welovenfts".
Returns:
- (string|array): Original plaintext or an error message.
Example Usage:
require_once 'vendor/autoload.php'; use encrypted_images_php\decryption\text; // Initialize the class $textDecryptor = new text(); // Decrypt an encrypted text $decryptedText = $textDecryptor->decrypt($encryptedText, 'decryption-key'); if ($decryptedText !== 'error') { // Proceed with the original plaintext } else { // Handle the decryption error }
Image Decryption
Decrypt data from an image and return the original plaintext.
Parameters:
$fileData(string): The image data or file path.$key(string, optional): The decryption key. Default is "welovenfts".$datatype(string, optional): The data type, either "web" or "json".
Returns:
- (string|array): An error message if decryption fails or the original plaintext.
Example Usage:
require_once 'vendor/autoload.php'; use encrypted_images_php\decryption\images; // Initialize the class $imageDecryptor = new images(); // Decrypt data from an image $decryptedText = $imageDecryptor->decryptFromImage($imageData, 'decryption-key', 'web'); if (!is_string($decryptedText)) { // Proceed with the original plaintext } else { // Handle the decryption error }
viraladmin/encrypted_images_php 适用场景与选型建议
viraladmin/encrypted_images_php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 10 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「images」 「encryption」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 viraladmin/encrypted_images_php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 viraladmin/encrypted_images_php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 viraladmin/encrypted_images_php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova field for distribute your images as array of object.
Pexels API Client for www.pexels.com
A simple PHP class to encrypt a string and decrypt an encrypted string
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Encryption with AES-256 and HMAC-SHA256
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-13