Class SimpleHashProvider

java.lang.Object
org.apache.shiro.crypto.hash.SimpleHashProvider
All Implemented Interfaces:
HashSpi

public class SimpleHashProvider extends Object implements HashSpi
Creates a hash provider for salt (+pepper) and Hash-based KDFs, i.e. where the algorithm name is a SHA algorithm or similar.
Since:
2.0
  • Constructor Details

  • Method Details

    • getImplementedAlgorithms

      Description copied from interface: HashSpi
      A list of algorithms recognized by this implementation.

      Example values are argon2id and argon2i for the Argon2 service provider and 2y and 2a for the BCrypt service provider.

      Specified by:
      getImplementedAlgorithms in interface HashSpi
      Returns:
      a set of recognized algorithms.
    • fromString

      public SimpleHash fromString(String format)
      Description copied from interface: HashSpi
      Creates a Hash instance from the given format string recognized by this provider.

      There is no global format which this provider must accept. Each provider can define their own format, but they are usually based on the crypt(3) formats used in /etc/shadow files.

      Implementations should overwrite this javadoc to add examples of the accepted formats.

      Specified by:
      fromString in interface HashSpi
      Parameters:
      format - the format string to be parsed by this implementation.
      Returns:
      a class extending Hash.
    • newHashFactory

      Description copied from interface: HashSpi
      A factory class for the hash of the type <T>.

      Implementations are highly encouraged to use the given random parameter as source of random bytes (e.g. for seeds).

      Specified by:
      newHashFactory in interface HashSpi
      Parameters:
      random - a source of Random, usually SecureRandom.
      Returns:
      a factory class for creating instances of <T>.