shaggyrec / php-encrypt-decrypt
此软件包最新版本(v1.0.0)没有提供许可信息。
简单的PHP加密解密器
v1.0.0
2019-01-14 17:13 UTC
Requires
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-09-15 18:02:42 UTC
README
使用openssl的简单PHP加密解密器
安装
composer require shaggyrec/php-encrypt-decrypt
用法
$phpEncryptorDecryptor = new PhpEncryptorDecryptor('secretKey', 'secretIv');
- 参数
- secretKey - 应该使用如openssl_random_pseudo_bytes等加密方式预先生成
- secretIv - 应该使用如openssl_random_pseudo_bytes等加密方式生成
- 返回值
- object PhpEncryptDecrypt\PhpEncryptorDecryptor
加密器
$phpEncryptorDecryptor->encrypt('string');
- 参数
- 编码字符串
- 返回值
- base64编码的字符串散列
解密器
$phpEncryptorDecryptor->decrypt('encrypted string');
- 参数
- 解码base64散列字符串
- 返回值
- 解码后的字符串
- 如果解码失败返回false