io.vertx.ext.auth.jdbc

## Interface JDBCHashStrategy

-     public interface JDBCHashStrategy

  Determines how the hashing is computed in the implementation You can implement this to provide a different hashing strategy to the default.
  Author:
    Tim Fox

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `computeHash(String password, String salt, int version)` Compute the hashed password given the unhashed password and the salt
    `String` | `generateSalt()` Compute a random salt.
    `String` | `getHashedStoredPwd(JsonArray row)` Retrieve the hashed password from the result of the authentication query
    `String` | `getSalt(JsonArray row)` Retrieve the salt from the result of the authentication query
    `void` | `setNonces(List<String> nonces)` Sets a ordered list of nonces where each position corresponds to a version.

- - ### Method Detail

    - #### generateSalt

          String generateSalt()

      Compute a random salt.
      Returns:
        a non null salt value

    - #### computeHash

          String computeHash(String password,
                             String salt,
                             int version)

      Compute the hashed password given the unhashed password and the salt
      Parameters:
        `password` - the unhashed password
        `salt` - the salt
        `version` - the nonce version to use
      Returns:
        the hashed password

    - #### getHashedStoredPwd

          String getHashedStoredPwd(JsonArray row)

      Retrieve the hashed password from the result of the authentication query
      Parameters:
        `row` - the row
      Returns:
        the hashed password

    - #### getSalt

          String getSalt(JsonArray row)

      Retrieve the salt from the result of the authentication query
      Parameters:
        `row` - the row
      Returns:
        the salt

    - #### setNonces

          void setNonces(List<String> nonces)

      Sets a ordered list of nonces where each position corresponds to a version. The nonces are supposed not to be stored in the underlying jdbc storage but to be provided as a application configuration. The idea is to add one extra variable to the hash function in order to make breaking the passwords using rainbow tables or precomputed hashes harder. Leaving the attacker only with the brute force approach.
      Parameters:
        `nonces` - a List of non null Strings.

Copyright © 2017. All rights reserved.