pollen-solutions/encryption
Composer 安装命令:
composer require pollen-solutions/encryption
包简介
Pollen Solutions - Encryption Component - Tools to encrypting and decrypting with AES-256 and AES-128 encryption.
README 文档
README
Pollen Solutions Encryption Component provides tools to encrypting and decrypting text via OpenSSL using AES-256 and AES-128 encryption.
Installation
composer require pollen-solutions/encryption
Basic Usage
use Pollen\Encryption\Encrypter; // Cypher (AES-128-CBC|AES-256-CBC) and Key definitions $cypher = 'AES-256-CBC'; // Recommended (use a static key. Replace 'static_key' by your own string) $key = md5('static_key'); // Dynamic random key (only valid during current request) // $key = Encrypter::generateKey($cypher); // Encrypter instanciation $encrypter = new Encrypter($key, $cypher); // To encrypt string $toEncrypt = 'toEncrypt'; // Encryption $encrypted = $encrypter->encrypt($toEncrypt); var_dump('encrypted string : ' . $encrypted); // ex. eyJpdiI6ImwxcmNicytwcVpkZmdsem4zTEpROVE9PSIsInZhbHVlIjoiK0JTN2EzWFVFazJoYi9abk1maW4vZz09IiwibWFjIjoiNDFiMzNlNzJkZjQxNGNhNmQyYmQ3MmViYjc0MTMyNmZiOTJmZTdlNDNmZmZiZGM3NzE1ZTc5YzE3YjIyZGQwZCJ9 // Décryption $decrypted = $encrypter->decrypt($encrypted); var_dump('decrypted string : ' . $decrypted); // >> toEncrypt
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-12