Interface HashSpi
- All Known Implementing Classes:
SimpleHashProvider
public interface HashSpi
Service Provider Interface for password hashing algorithms.
Apache Shiro will load algorithm implementations based on the method getImplementedAlgorithms().
Loaded providers are expected to return a suitable hash implementation.
Modern kdf-based hash implementations can extend the AbstractCryptHash class.
- Since:
- 2.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfromString(String format) Creates a Hash instance from the given format string recognized by this provider.A list of algorithms recognized by this implementation.newHashFactory(Random random) A factory class for the hash of the type<T>.
-
Method Details
-
getImplementedAlgorithms
A list of algorithms recognized by this implementation.Example values are
argon2idandargon2ifor the Argon2 service provider and2yand2afor the BCrypt service provider.- Returns:
- a set of recognized algorithms.
-
fromString
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/shadowfiles.Implementations should overwrite this javadoc to add examples of the accepted formats.
- Parameters:
format- the format string to be parsed by this implementation.- Returns:
- a class extending Hash.
-
newHashFactory
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).
- Parameters:
random- a source ofRandom, usuallySecureRandom.- Returns:
- a factory class for creating instances of
<T>.
-