1. Go to this page and download the library: Download shetabit/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/ */
shetabit / crypto example snippets
$crypto = new Crypto;
// generate private key
$privateKey = $crypto->createPrivateKey();
echo $privateKey;
// generate public key
$publicKey = $crypto->createPublicKey($privateKey);
echo $publicKey;
$data = 'a simple text';
// encrypt, plain data
$encryptedData = $crypto->encrypt($publicKey, $data);
echo $encryptedData;
// decrypt, encrypted data
$decryptedData = $crypto->decrypt($privateKey, $encryptedData);
echo $decryptedData;
$crypt = new Crypt;
$privateKey = $crypt->createPrivateKey();
echo $privatekey;
$crypt = new Crypt;
$privateKey = $crypt->createPrivateKey(Crypto::OPENSSL_KEYTYPE_RSA);
echo $privatekey;