php ^5.3.3
or ^7.0
with extension OpenSSL or Mcrypt
composer require hobocta/encrypt
use Hobocta\Encrypt\Encryptor\Fabric\EncryptorFabric;
use Hobocta\Encrypt\EncryptService;
use Hobocta\Encrypt\Stringify\Base64Stringify;
$data = 'My secret data!';
$password = '1234';
$encryptService = new EncryptService(
(new EncryptorFabric(sha1($password)))->createEncryptor128(),
new Base64Stringify()
);
$encrypted = $encryptService->encrypt($data); // 'fxVrDEtIb/krb8fHW6hhVDbH9VeV1Lwbs3hM35ITtc8='
$decrypted = $encryptService->decrypt($encrypted); // 'My secret data!'
php examples/simple.php
code
php examples/all.php
php examples/performance.php
phpunit