polarising/bcrypt
最新稳定版本:1.0.2
Composer 安装命令:
composer require polarising/bcrypt
包简介
Customized Bcrypt for PHP
关键字:
README 文档
README
========
Instead of using PHP hash password API, encrypt plain text by using Bcrypt algorithm, and make sure it's compatible with Bcrypt in other programming languages, like Java, python.
Installing Bcrypt
The recommended way to install Bcrypt is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Bcrypt:
php composer.phar require polarising/bcrypt
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
You can then later update Bcrypt using composer:
composer.phar update
Quick Examples
Encrypt Plaintext, Verify Plaintext and Ciphertext
<?php // Require the Composer autoloader. require 'vendor/autoload.php'; use Bcrypt\Bcrypt; // Instantiate an Bcrypt instance. $bcrypt = new Bcrypt(); //Encrypt the plaintext $plaintext = 'password'; //Set the Bcrypt Version, default is '2y' $bcrypt_version = '2a'; $ciphertext = $bcrypt->encrypt($plaintext,$bcrypt_version); print_r("\n Plaintext:".$plaintext); print_r("\n Ciphertext:".$ciphertext); //Verify the plaintext and ciphertext if($bcrypt->verify($plaintext, $ciphertext)){ print_r("\n Password verified!"); }else{ print_r("\n Password not match!"); }
统计信息
- 总下载量: 59.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-02