talex/helpers

1.0 2023-10-20 20:30 UTC

This package is auto-updated.

Last update: 2024-09-21 11:59:52 UTC


README

要安装talex/helpers,请运行以下命令

composer require talex/helpers
use  Talex\Helpers\Text;
$string = "example"
$text = new Text($string);

echo $text->truncate()->getText();

使用Hash类

use  Talex\Helpers\Hash;

$plain_txt = "This is my plain text";
echo "Plain Text =" .$plain_txt. "\n";
$hash = new Hash($plain_txt);
$hash->setSecretKey("my secret key");
$hash->setSecretIV("my secret IV");

$encrypted_txt = $hash->encrypt();
echo "Encrypted Text = " .$encrypted_txt. "\n";
$decrypted_txt = $hash->decrypt($encrypted_txt);
echo "Decrypted Text =" .$decrypted_txt. "\n";
if ( $plain_txt === $decrypted_txt ) echo "SUCCESS";
else echo "FAILED";
echo "\n";