PHP code example of martinusso / opencrypt
1. Go to this page and download the library: Download martinusso/opencrypt 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/ */
martinusso / opencrypt example snippets
$password = "OpenCrypt";
// Should have been previously generated in a cryptographically safe way
$secretKey = 'SECRET_KEY';
// You can pass the IV as argument or it is generated automatically
$openCrypt = new OpenCrypt($secretKey [, string $iv ]);
// get the IV
$iv = $openCrypt->iv();
// encrypt
$encryptedPassword = $openCrypt->encrypt($password);
// $encryptedPassword = 'GWw3bqL7FqjmRs0yyIR/8A=='
// decrypt
$decryptedPassword = $openCrypt->decrypt($encryptedPassword);
// $decryptedPassword = 'OpenCrypt'