djm56/php-string-encryption
最新稳定版本:v1.0.1
Composer 安装命令:
composer require djm56/php-string-encryption
包简介
Encrypt and Decrypt a String
README 文档
README
Class to encrypt and decrypt a string using openssl and open64.
I have used this in the past to encrypt/decrypt data at rest inside cookies that get used server side, or to encrypt/decrypt data at rest inside database.
This repo is still in development
Installation
This project is using composer.
$ composer require djm56/php-string-encrytion
Usage
Define constants the encrytion_key please change to something unique, the encrytion_type can stay the same.
define('ENCRYPTION_KEY', 'abcdefghij1234'); define('ENCRYPTION_TYPE', 'AES-128-CBC');
Choosing the correct Encrytption type or cipher use the available php function to list them from instruction on this page
https://www.php.net/manual/en/function.openssl-get-cipher-methods.php
How to encrypt and decrypt:
use StringEncryption\Encryption; $encryptedtext = Encryption::encrypt('test string'); $decryptedtext = Encryption::decrypt('encrypted string');
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-09-20