PHP code example of l-freeze / crypto
1. Go to this page and download the library: Download l-freeze/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/ */
l-freeze / crypto example snippets
//index.php
declare(strict_types=1);
by Sodium
Crypto::setcryptoMethod(Crypto::METHOD_SODIUM);
$key ='EncryptionKey#MustStringLength32';
$iv = 'InitializationVector::24';
$resource = <<<EOT
=========================
[SODIUM: Specified iv -> FixedEncryptedString]
=========================
EOT;
$encrypted = Crypto::encrypt($resource, $key, $iv);
print_r($encrypted);
$decrypted = Crypto::decrypt($encrypted, $key, $iv);
print_r($decrypted);
php index.php