pentagonal / simple_encrypt
简单的加密工具
1.0.0
2017-08-21 14:59 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is not auto-updated.
Last update: 2024-09-15 00:40:07 UTC
README
另一个小型加密助手
将字符串或其他类型的值加密。默认使用 openssl
并默认使用 AES-256-CBC
加密,另一个加密使用 str_rot13
并通过 base64_encode
编码
加密
/** * Using default encryption mcrypt */ Pentagonal\SimpleEncryption\Encryption::encrypt('string to encrypt', 'saltkey'); /** * Using alternative type */ Pentagonal\SimpleEncryption\Encryption::altEncrypt('string to encrypt', 'saltkey');
解密
/** * Decrypt encrypted string with auto detect encryption use */ Pentagonal\SimpleEncryption\Encryption::decrypt('string to decrypt', 'saltkey'); // or can use Pentagonal\SimpleEncryption\Encryption::altDecrypt('string to decrypt', 'saltkey');
使用 Composer 安装
Composer 是一个方便的工具,可以轻松地将 Packagist 和其他资源中的库添加到您的应用程序中。获取安装方法请访问:https://getcomposer.org 并在您的操作系统上安装。
{ "require": { "pentagonal/simple_encrypt" : "~1.0" } }
或者直接通过 终端
安装
composer require pentagonal/simple_encrypt
要求
此库需要 PHP 5.4.0 或更高版本。建议在您的 PHP 配置中启用 openssl
。