PHP code example of sicet7 / gcm

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

    

sicet7 / gcm example snippets




use Sicet7\GCM\Encryptor;
use Sicet7\GCM\EncryptionVersion;

n fox jumps over the lazy dog';

// Encrypt Data.
$encryptedString = Encryptor::encrypt(
    plainText: $data,
    key: $key,
    version: EncryptionVersion::V2 // It's recommended to use version 2 for all new data, V1 is only here for backwards compatibility
);

// Decrypt Data.
$decryptedData = Encryptor::decrypt(
    cipherText: $encryptedString,
    key: $key
);

//Should output: "The quick brown fox jumps over the lazy dog"
echo $decryptedData;