rafrsr / crypto
Easy encrypt and decrypt strings in PHP.
Installs: 27 828
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: 4.1.*
- satooshi/php-coveralls: ~1.0
- toplib/coding-standard: dev-master
README
Easy encrypt and decrypt strings in PHP.
Features
- Easy usage
Crypto::build('secretKey')->encrypt('secret message')
- Support most populars MCRYPT algorithms
- Encryption verification through the method
isEncrypted($data)
- Prevent double encryption/decryption
Usage
use Rafrsr\Crypto\Crypto; $encryptor = Crypto::build('JH83UN177772JJASHGAGG38UABASDSD'); //$encryptor = Crypto::build('JH83UN177772JJASHGAGG38UABASDSD', MCRYPT_RIJNDAEL_128); //using specific algorithm $secret = $encryptor->encrypt('This is a secret message'); if ($encryptor->isEncrypted($secret)) { echo 'The messages is encrypted'; } $notSecret = $encryptor->decrypt($secret); if (!$encryptor->isEncrypted($notSecret)) { echo 'The message is not encrypted'; }