PHP code example of eddieantonio / bcrypt
1. Go to this page and download the library: Download eddieantonio/bcrypt 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/ */
eddieantonio / bcrypt example snippets
$hashed = \Bcrypt\hash('this is a random string');
// elsewhere...
$plain_text_password = //...
if (\Bcrypt\verify($plain_text_password, $user_pass_hash)) {
login();
}
// Control the prefix, number of rounds...
$bcrypt = new \Bcrypt\Bcrypt('prefix', 15);
// And use the instance to produce many hashes.
$hashes[] = $bcrypt->hash('this is a string');
$hashes[] = $bcrypt->hash('this is another string');
// You can also do this:
if ($bcrypt->verify($plain_text_password, $user_pass_hash)) {
login();
}