定制 meezaan/aescryptor 二次开发

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

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

meezaan/aescryptor

Composer 安装命令:

composer require meezaan/aescryptor

包简介

A library to encrypt / decrypt strings using the AES algorithm

README 文档

README

A basic PHP package for encrypting and decrypting strings using an AES 256-bit key.

This library requires the PHP OpenSSL extension.

This package is based on https://gist.github.com/turret-io/957e82d44fd6f4493533.

Installation

The package can be installed via composer:

composer install neezaan\aescryptor

Usage

This package can generate a secure key and initialisation vector for you. You will need to store the key securely, but this package handles storing the IV itself with the encrypted string, so you don't have to store it elsewhere. Arguably this is less secure, but it makes the implementation simpler.

<?php 
use Meezaan\Aescryptor\Generate;
use Meezaan\Aescryptor\Aes;

// Generate a 256-bit key. Store this somewhere in a secure vault. You don't need this step as you can generate your own key elsewhere too.
$key = Generate::key();

// Our secret
$secret = 'A_Secret';

// Instantiate the Aes class.
$aes = new Aes($key);

// Encrypt your string
$encrypted = $aes->encrypt($secret);

// Decrypt your string
$decrypted = $aes->decrypt($encrypted);

// Note that $decrypted === $secret

Purpose

This library is built primarily for interoperability between applications and pipelines.

Interoperability via Bash

Results produced by this library are not interoperable with the openssl cli on Linux.

To get the same results with PHP, see https://stackoverflow.com/questions/71198954/openssl-aes-256-cbc-encryption-from-command-prompt-and-decryption-in-php-and-vi.

Credits

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固