fzed51 / spicy-mash
基于 OpenSSL 的简化加密和解密类
v1.1.0
2021-11-02 23:25 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