`
gaojingsong
  • 浏览: 1156856 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Bcrypt简介

 
阅读更多
Bcrypt简介: bcrypt是一种跨平台的文件加密工具。

bcrypt 使用的是布鲁斯·施内尔在1993年发布的 Blowfish 加密算法。

由它加密的文件可在所有支持的操作系统和处理器上进行转移。它的口令必须是8至56个字符,并将在内部
被转化为448位的密钥。

Bcrypt就是一款加密工具,可以比较方便地实现数据的加密工作。你也可以简单理解为它内部自己实现了
随机加盐处理

例如,我们使用MD5加密,每次加密后的密文其实都是一样的,这样就方便了MD5通过大数据de的方式
进行破解。

Bcrypt生成的密文是60位的。而MD5的是32位的。

jBCrypt is a Java™ implementation of OpenBSD's Blowfish password hashing code,
 as described in "A Future-Adaptable Password Scheme" by Niels Provos and David Mazières.
This system hashes passwords using a version of Bruce Schneier's Blowfish
 block cipher with modifications designed to raise the cost of off-line 
password cracking and frustrate fast hardware implementation. The computation
 cost of the algorithm is parametised, so it can be increased as computers 
get faster. The intent is to make a compromise of a password database less likely 
to result in an attacker gaining knowledge of the plaintext passwords (e.g. using John the Ripper).
There seems to be a lack of good password hashes for Java - the top two hits 
in Google (as of 2006/05/24) for "Java password hash" and "Java password encryption" both offer terrible advice: one uses an unsalted hash which allows reverse dictionary lookup of passwords and the other recommends reversible encryption, which is rarely needed and should only be used as a last resort.
jBCrypt is licensed under a ISC/BSD licence (see the LICENSE file for details) and ships with a set of JUnit unit tests to verify correct operation of the library and compatibility with the canonical C implementation of the bcrypt algorithm.


BCrypt加密:是一种加盐的加密方法,MD5加密时候,同一个密码经过hash的时候生成的是
同一个hash值,在大数据的情况下,有些经过md5加密的方法将会被破解.使用BCrypt进行加密,
同一个密码每次生成的hash值都是不相同的。每次加密的时候首先会生成一个随机数就是盐,
之后将这个随机数与密码进行hash,得到 一个hash值存到数据库中使用的函数是
BCrypt.hashpw(password, BCrypt.gensalt())。当用户在登陆的时候,输入的是明文的密码,
这个时候,在springSecurity.xml文件中的认证管理器中配置BCrypt加密方式,将会将会从
数据库中取出这个hash值进行分离,前面的22位就是加的盐,之后将随机数与前端输入的密码
进行组合求hash值判断是否相同,使用的函数是: match 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics