定制 mjohann/simple-aes-256 二次开发

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

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

mjohann/simple-aes-256

最新稳定版本:v1.1.0

Composer 安装命令:

composer require mjohann/simple-aes-256

包简介

Simple AES 256 is a PHP class designed to simplify encryption and decryption using AES-256 in CBC or GCM modes.

README 文档

README

SimpleAES256 is a PHP class designed to simplify encryption and decryption using AES-256 in CBC or GCM modes.

📦 Installation

You can install the library via Packagist/Composer:

composer require mjohann/simple-aes-256

⚙️ Requirements

  • PHP 8.0 or higher

🚀 Features

  • Supported AES 256 CBC and AES 256 GCM:
    • encrypt
    • decrypt
    • key
    • tag

🧪 Usage Example

Example AES 256 CBC

<?php

use MJohann\Packlib\SimpleAES256;

require_once "vendor/autoload.php";

$aes = new SimpleAES256("MyPassword");
$text = "My name is Matheus";

$encrypt = $aes->encrypt_cbc($text);
$decrypt = $aes->decrypt_cbc($encrypt);

echo "Simple AES 256 CBC", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL, PHP_EOL;

Example AES 256 GCM

<?php

use MJohann\Packlib\SimpleAES256;

require_once "vendor/autoload.php";

$aes = new SimpleAES256("MyPassword");
$text = "My name is Matheus";

$encrypt = $aes->encrypt_gcm($text);
$tag = $aes->get_tag();
$decrypt = $aes->decrypt_gcm($encrypt, $tag);

echo "Simple AES 256 GCM", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Tag: ", $tag, PHP_EOL, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL;

For more examples, see the example/script.php file in the repository.

📁 Project Structure

simple-aes-256/
├── src/
│   └── SimpleAES256.php
│   └── Facades/
│       └── SimpleAES256.php
├── example/
│   └── script.php
├── composer.json
├── .gitignore
├── LICENSE
└── README.md

📄 License

This project is licensed under the MIT License. See the LICENSE file for more information.

👨‍💻 Author

Developed by Matheus Johann Araújo – Pernambuco, Brazil.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-14