fzed51/spicy-mash

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

v1.1.0 2021-11-02 23:25 UTC

This package is auto-updated.

Last update: 2024-08-29 05:31:29 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