JavaXT
|
|||||||||||
BCrypt ClassProvides static methods used to encrypt passwords. The encryption is "one-way" meaning that passwords can be encrypted but not decrypted. Although you cannot decrypt a password, you can still validate a password using the checkpw() method. Example usage:
public class User { private String password; public boolean authenticate(String password){ return BCrypt.checkpw(password, this.password); } public void setPassword(String password){ this.password = BCrypt.hashpw(password, BCrypt.gensalt()); } }This class was originally developed by Damien Miller and is based on Bruce Schneier's Blowfish cipher. ConstructorsThere are no public constructors.Static Methodshashpw( String password, String salt ) returns String Returns a BCrypt hashed password
hasSalt( String password ) returns boolean Returns true if a given string starts with a valid BCrypt hash gensalt( int log_rounds, SecureRandom random ) returns String Generate a salt for use with the BCrypt.hashpw() method
gensalt( int log_rounds ) returns String Generate a salt for use with the BCrypt.hashpw() method
gensalt( ) returns String Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable default for the number of hashing rounds to apply
checkpw( String plaintext, String hashed ) returns boolean Returns true if a plain-text password matches a BCrypt hashed password
Public Classes |