PHP code example of baha2rmirzazadeh / phpguard

1. Go to this page and download the library: Download baha2rmirzazadeh/phpguard 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/ */

    

baha2rmirzazadeh / phpguard example snippets


use PHPGuard\Crypto\Crypto;
use PHPGuard\Crypto\Key;

$cr = new Crypto("CAST5-CBC");
$cr->setKey(Key::getKey());
$c = $cr->encrypt([
        "Name"      => "Baha2r",
        "LastName"  => "Mirzazadeh",
        "Age"       => 22,
        "IsStudent" => true,
        "Courses"   => ["Math", "Ecocnomy", "Chemistry"]
]);
print $c."\n";
print_r($cr->decrypt($c));


$cr = $cr->setCipher("AES-192-CBC");
$cr->setKey(Crypto::generateKey());
$c = $cr->encrypt([
        "Name"      => "Baha2r",
        "LastName"  => "Mirzazadeh",
        "Age"       => 22,
        "IsStudent" => true,
        "Courses"   => ["Math", "Ecocnomy", "Chemistry"]
]);
print $c."\n";
print_r($cr->decrypt($c));
print_r(Crypto::supported());