OpenBSDBCrypt (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.crypto.generators

## Class OpenBSDBCrypt

- java.lang.Object
- - org.bouncycastle.crypto.generators.OpenBSDBCrypt

-     public class OpenBSDBCrypt
      extends java.lang.Object

  Password hashing scheme BCrypt, designed by Niels Provos and David Mazières, using the String format and the Base64 encoding of the reference implementation on OpenBSD

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OpenBSDBCrypt()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `checkPassword(java.lang.String bcryptString, char[] password)` Checks if a password corresponds to a 60 character Bcrypt String
    `static java.lang.String` | `generate(char[] password, byte[] salt, int cost)` Creates a 60 character Bcrypt String, including version, cost factor, salt and hash, separated by '$'

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OpenBSDBCrypt

          public OpenBSDBCrypt()

  - ### Method Detail

    - #### generate

          public static java.lang.String generate(char[] password,
                                  byte[] salt,
                                  int cost)

      Creates a 60 character Bcrypt String, including version, cost factor, salt and hash, separated by '$'
      Parameters:
        `cost` - the cost factor, treated as an exponent of 2
        `salt` - a 16 byte salt
        `password` - the password
      Returns:
        a 60 character Bcrypt String

    - #### checkPassword

          public static boolean checkPassword(java.lang.String bcryptString,
                              char[] password)

      Checks if a password corresponds to a 60 character Bcrypt String
      Parameters:
        `bcryptString` - a 60 character Bcrypt String, including version, cost factor, salt and hash, separated by '$'
        `password` - the password as an array of chars
      Returns:
        true if the password corresponds to the Bcrypt String, otherwise false