unofficialmc2 / spicy-mash
基于 OpenSSL 的简化加密和解密类
v1.1.1
2023-02-21 10:17 UTC
Requires
- php: >=7.4
- ext-openssl: *
Requires (Dev)
- ocramius/package-versions: ^2.1
- phpstan/phpstan: ^0.12.80
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
README
基于 OpenSSL 的简化哈希、加密和解密类
安装
composer require fzed51/spicy-mash
使用
加密
<?php $mash = new \Helper\SpicyMash(); $mashed = $mash->crypt('message', 'spicy'); echo $mash->decrypt($mashed, 'spicy'); // message
<?php $mash = new \Helper\SpicyMash('spicy'); $mashed = $mash->crypt('message', 'more spicy'); echo $mash->decrypt($mashed, 'more spicy'); // message
<?php $mash = new \Helper\SpicyMash('spicy'); $mashed = $mash->crypt('message'); echo $mash->decrypt($mashed); // message
如果缺少密钥(主要和特定密钥)将引发异常。
如果解密出现问题时将引发异常
哈希
$mash = new \Helper\SpicyMash(); $mashed = $mash->hash('message'); echo $mashed; // f8daf57a33..//..1770d5952c