shaggyrec / php-encrypt-decrypt
There is no license information available for the latest version (v1.0.0) of this package.
Simple PHP encryptor-decryptor
v1.0.0
2019-01-14 17:13 UTC
Requires
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-03-15 17:03:08 UTC
README
Simple PHP encryptor-decryptor using openssl
Install
composer require shaggyrec/php-encrypt-decrypt
Usage
$phpEncryptorDecryptor = new PhpEncryptorDecryptor('secretKey', 'secretIv');
- Params
- secretKey - should have been previously generated in a cryptographically safe way, like openssl_random_pseudo_bytes
- secretIv - should have been generated n a cryptographically safe way, like openssl_random_pseudo_bytes
- Returns
- object PhpEncryptDecrypt\PhpEncryptorDecryptor
Encryptor
$phpEncryptorDecryptor->encrypt('string);
- Params
- encoding string
- Returns
- base64 encoded string hash
Decryptor
$phpEncryptorDecryptor->decrypt('encrypted string);
- Params
- decoding base64 hash string
- Returns
- Decoded string
- false if decoding was fail