nichin79/encrypt-php

此包的最新版本(v1.0.1)没有可用的许可证信息。

PHP的基本加密/解密

v1.0.1 2024-02-24 21:19 UTC

This package is auto-updated.

Last update: 2024-09-24 22:51:47 UTC


README

PHP的openssl_encrypt和openssl_decrypt功能的简单类

示例

<?php

require_once __DIR__ . '/../vendor/autoload.php';

use Nichin79\Encryption\Encryption;

$encryption = new Encryption([
  'passphrase' => 'pass1234',
]);

$string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
$encrypted = $encryption->encrypt($string);
$decrypted = $encryption->decrypt($encrypted);

echo "\r\nOriginal String:\r\n$string\r\n";
echo "\r\nEncrypted String:\r\n$encrypted\r\n";
echo "\r\nDecrypted String:\r\n$decrypted\r\n";