Class DefaultHashService

java.lang.Object
org.apache.shiro.crypto.hash.DefaultHashService
All Implemented Interfaces:
ConfigurableHashService, HashService

public class DefaultHashService extends Object implements ConfigurableHashService
Default implementation of the HashService interface, supporting a customizable hash algorithm name.

Hash Algorithm

You may specify a hash algorithm via the setDefaultAlgorithmName(String) property. Any algorithm name understood by the JDK MessageDigest.getInstance(String algorithmName) method will work, or any Hash algorithm implemented by any loadable HashSpi. The default is argon2.

A hash and the salt used to compute it are often stored together. If an attacker is ever able to access the hash (e.g. during password cracking) and it has the full salt value, the attacker has all of the input necessary to try to brute-force crack the hash (source + complete salt).

However, if part of the salt is not available to the attacker (because it is not stored with the hash), it is much harder to crack the hash value since the attacker does not have the complete inputs necessary.

Since:
1.2