unofficialmc2/spicy-mash

基于 OpenSSL 的简化加密和解密类

v1.1.1 2023-02-21 10:17 UTC

This package is auto-updated.

Last update: 2024-09-21 14:26:45 UTC


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