zqhong / encrypter
A powerful encrypter library based on illuminate/encryption
v1.1
2017-04-09 10:12 UTC
Requires
- php: >=5.4.0
- ext-mbstring: *
- ext-openssl: *
- paragonie/random_compat: v2.0.10
Requires (Dev)
- phpunit/phpunit: 5.7.19
This package is not auto-updated.
Last update: 2024-11-15 21:39:06 UTC
README
The encryption algorithms that Encrypter supports:
- AES-128-CFB
- AES-192-CFB
- AES-256-CFB
- RC4
- RC4-MD5
Simple
<?php require __DIR__ . "/vendor/autoload.php"; use Zqhong\Encrypter\Encrypter; $key = 'password'; $cipher = 'RC4-MD5'; $plainText = 'hello world'; $encrypter = new Encrypter($key, $cipher); $payload = $encrypter->encryptString($plainText); echo $payload . PHP_EOL; echo $encrypter->decryptString($payload) . PHP_EOL; // will output //eyJpdiI6IiIsInZhbHVlIjoiMDIxR1dXcHg4K21yR2RBPSIsIm1hYyI6ImRhYzFjYWFjODg5ODA1MWFlMWE0OTZmYTNjMTlkYWIxNDExZjAzYzU2ZjlhM2FmMTY1ZWYwYjFkYTJiZjJkNjgifQ== //hello world