PHP code example of rafrsr / crypto

1. Go to this page and download the library: Download rafrsr/crypto library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rafrsr / crypto example snippets



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