ageid/encryption-helper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ageid/encryption-helper

最新稳定版本:2.1

Composer 安装命令:

composer create-project ageid/encryption-helper

包简介

AgeID symmetric encryption helper

README 文档

README

AES256 encryption and decryption helper for AgeID using an embedded random salt key.

The implementation is based on Laravel Encrypter.

Requirements: PHP 7

For PHP 5.6 compatibility, please install the PHP 5.x polyfill for random_bytes() :

composer require paragonie/random_compat 

Change Log

List of releases and changes, with the latest at the top:

  • v2.1
    • fixed compatibility with php 5.6
    • removed utf8 conversion for salt that was causing entropy loss
  • v2.0 [!] Should be used for v2 endpoint and forward [!]
    • The number of iterations in EncryptionHelper is set by setting the version number on Instantiation; if it not set it will choose the latest version
    • Only allow salt with at least 16 Bytes
    • reduced the number of iterations to be 1024 by default
  • [first-release]

Usage

Installation

Use composer to install the package

composer require ageid/encryption-helper 

or download the the package and include the src/* files in your project.

Encryption

By default, it uses a random salt key, but it can be specified in the constructor.

Example:

 use AgeId\EncryptionHelper; $password = "8d6ea4d3e6f8c4f8641516baa5e42b85"; $text = "text clear"; $encrypter = new EncryptionHelper($password); $encrypted = $encrypter->encrypt($text); echo $encrypted; 

Decryption

Example:

 use AgeId\EncryptionHelper; $password = "8d6ea4d3e6f8c4f8641516baa5e42b85"; $hash = "eyJzYWx0IjoiVWluUHJUOFwvZVQ5REZUZ1wvUHo4NyIsImVuY3J5cHRlZCI6IjJxbzgzcmRsMWNWQ0VJTHVjazBJSFE9PSIsIm1hYyI6IjJmYWM3NWY4ZTk4NmI1MGYwMzgwYTcxYTgwMTA3NmNiM2Y3Y2MwYzBkZDNkNWIwOGYxNTI2ZTkwYTRlMTdkZjgifQ=="; $decryptor = new EncryptionHelper($password); $decrypted = $decryptor->decrypt($hash); echo $decrypted; 

Tests

In order to run the tests, please run in the package folder:

composer install phpunit 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固