DefaultHashService.computeHash

Computes and responds with a hash based on the specified request. <p/> This implementation functions as follows: <ul> <li>If the request's {@link hunt.shiro.crypto.hash.HashRequest#getSalt() salt} is null: <p/> A salt will be generated and used to compute the hash. The salt is generated as follows: <ol> <li>Use the {@link #getRandomNumberGenerator() randomNumberGenerator} to generate a new random number.</li> <li>{@link #combine(ByteSource, ByteSource) combine} this random salt with any configured {@link #getPrivateSalt() privateSalt} </li> <li>Use the combined value as the salt used during hash computation</li> </ol> </li> <li> If the request salt is not null: <p/> This indicates that the hash computation is for comparison purposes (of a previously computed hash). The request salt will be {@link #combine(ByteSource, ByteSource) combined} with any configured {@link #getPrivateSalt() privateSalt} and used as the complete salt during hash computation. </li> </ul> <p/> The returned {@code Hash}'s {@link Hash#getSalt() salt} property will contain <em>only</em> the 'public' part of the salt and <em>NOT</em> the privateSalt. See the class-level JavaDoc explanation for more info.

@param request the request to process @return the response containing the result of the hash computation, as well as any hash salt used that should be exposed to the caller.

class DefaultHashService
computeHash

Meta