PHP code example of internetpixels / sodium-encryption
1. Go to this page and download the library: Download internetpixels/sodium-encryption 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/ */
internetpixels / sodium-encryption example snippets
// Update the keys (create a new unique keypair)!
\InternetPixels\SodiumEncryption\EncryptionManager::setKeys(
'1d17336ba7b2cec7dc8ec788e78ebf835d9f85cfc414275e92fd8e3ae5d6d2b6',
'b88fc95850eec82492e9f0616cfeb69b9205735e34f5ce5e83d681eb38147d57'
);
$string = 'This is my default text string with 88 numbers!';
$nonce = EncryptionManager::generateNonce();
$encrypted = EncryptionManager::encrypt($string, $nonce);
$string = EncryptionManager::decrypt($encrypted, $nonce);