Skip to content

rafrsr/crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto

Build Status Coverage Status Latest Stable Version Latest Unstable Version Total Downloads License

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';
}