webnarmin/cryptor
最新稳定版本:v1.0.1
Composer 安装命令:
composer require webnarmin/cryptor
包简介
A simple encryption and decryption library
README 文档
README
A simple PHP library for encrypting and decrypting data using AES-256-CBC.
Installation
You can install the Cryptor library via Composer. Run the following command in your project directory:
composer require webnarmin/cryptor
Usage
Here's a quick example of how to use the Cryptor class:
Encrypting Data
<?php require 'vendor/autoload.php'; use webnarmin\Cryptor\Cryptor; $privateKey = 'your_private_key'; $publicKey = 'your_public_key'; $data = 'Hello, world!'; $cryptor = new Cryptor($privateKey); $encryptedData = $cryptor->encrypt($data, $publicKey); echo 'Encrypted Data: ' . $encryptedData;
Decrypting Data
<?php require 'vendor/autoload.php'; use webnarmin\Cryptor\Cryptor; $privateKey = 'your_private_key'; $publicKey = 'your_public_key'; $encryptedData = 'your_encrypted_data'; $cryptor = new Cryptor($privateKey); $decryptedData = $cryptor->decrypt($encryptedData, $publicKey); echo 'Decrypted Data: ' . $decryptedData;
Running Tests
To run tests, you need to have PHPUnit installed. If you don't have it installed, you can install it via Composer:
composer require --dev phpunit/phpunit
Run the tests using the following command:
vendor/bin/phpunit
License
This library is licensed under the MIT License.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-28