hobocta / encrypt
Easy way to use data encryption
v1.0.2
2018-12-11 09:36 UTC
Requires
- php: ^5.3.3 || ^7.0
This package is auto-updated.
Last update: 2024-09-12 04:05:34 UTC
README
Requirements
php ^5.3.3
or ^7.0
with extension OpenSSL or Mcrypt
Install
composer require hobocta/encrypt
Usage
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!'
Run simple example
php examples/simple.php
code
Run example with all variants
php examples/all.php
Run performance test for all variants
php examples/performance.php
Run unit tests
phpunit