1. Go to this page and download the library: Download popphp/pop-crypt 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/ */
popphp / pop-crypt example snippets
use Pop\Crypt\Hashing;
$hasher = Hashing\BcryptHasher::create();
$hashedValue = $hasher->make('password');
if ($hasher->verify('password', $hashedValue)) {
echo 'You shall pass!' . PHP_EOL;
} else {
echo 'YOU SHALL NOT PASS!' . PHP_EOL;
}
use Pop\Crypt\Encryption;
$encrypter = new Encryption\Encrypter($mySecureKey, 'aes-256-cbc');
// Returns a base-64 encoded string of the encrypted data
$encryptedData = $encrypter->encrypt('SENSITIVE_DATA');
// Returns the valid, decrypted data
try {
$decryptedData = $encrypter->decrypt($encryptedData);
// Else, throws an error exception is something is incorrect or invalid
} catch (\Exception $e) {
echo $e->getMessage();
}
use Pop\Crypt\Encryption;
$key = Encryption\Encrypter::generateKey($cipher, false);
use Pop\Crypt\Encryption;
$encrypter = new Encryption\Encrypter($currentKey, 'aes-256-cbc');
$encrypter->setPreviousKeys([$oldKey1, $oldKey2, $oldKey3]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.