PHP code example of brenno-duarte / php-secure-password
1. Go to this page and download the library: Download brenno-duarte/php-secure-password 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/ */
brenno-duarte / php-secure-password example snippets
use SecurePassword\SecurePassword;
$password = new SecurePassword();
$hash = $password->createHash('my_password')->getHash();
/** Return string */
var_dump($hash);
use SecurePassword\Encrypt\Encryption;
$encryption = new Encryption('your-key');
//Encrypt the message
$encrypt = $encryption->encrypt("This is a text");
echo $encrypt;
$encryption = new Encryption('your-key');
//Decrypt the message
$decrypt = $encryption->decrypt($encrypt);
echo $decrypt;
$encryption = new Encryption(new OpenSslEncryption('your-key'));
$encryption = new Encryption(new SodiumEncryption('your-key'));
$password = new SecurePassword();
$password->setPepper('new_pepper');
// Use OpenSSL
$password->setPepper('new_pepper', 'openssl');
// Use Sodium
$password->setPepper('new_pepper', 'sodium');